@@ -25,7 +25,7 @@ use fs_err as fs;
2525use http_client:: prpc:: PrpcClient ;
2626use or_panic:: ResultOrPanic ;
2727use ra_rpc:: { CallContext , RpcCall , VerifiedAttestation } ;
28- use ra_tls:: attestation:: QuoteContentType ;
28+ use ra_tls:: attestation:: { AppInfo , QuoteContentType } ;
2929use rand:: seq:: IteratorRandom ;
3030use rinja:: Template as _;
3131use safe_write:: safe_write;
@@ -709,6 +709,7 @@ pub(crate) fn encode_ts(ts: SystemTime) -> u64 {
709709
710710pub struct RpcHandler {
711711 remote_app_id : Option < Vec < u8 > > ,
712+ remote_app_info : Option < AppInfo > ,
712713 attestation : Option < VerifiedAttestation > ,
713714 state : Proxy ,
714715}
@@ -730,12 +731,16 @@ impl RpcHandler {
730731
731732impl GatewayRpc for RpcHandler {
732733 async fn register_cvm ( self , request : RegisterCvmRequest ) -> Result < RegisterCvmResponse > {
733- let Some ( ra) = & self . attestation else {
734- bail ! ( "no attestation provided" ) ;
734+ let app_info = match self . remote_app_info {
735+ Some ( app_info) => app_info,
736+ None => {
737+ let Some ( ra) = & self . attestation else {
738+ bail ! ( "neither app-info nor attestation provided" ) ;
739+ } ;
740+ ra. decode_app_info ( false )
741+ . context ( "failed to decode app-info from attestation" ) ?
742+ }
735743 } ;
736- let app_info = ra
737- . decode_app_info ( false )
738- . context ( "failed to decode app-info from attestation" ) ?;
739744 self . state
740745 . auth_client
741746 . ensure_app_authorized ( & app_info)
@@ -869,6 +874,7 @@ impl RpcCall<Proxy> for RpcHandler {
869874 fn construct ( context : CallContext < ' _ , Proxy > ) -> Result < Self > {
870875 Ok ( RpcHandler {
871876 remote_app_id : context. remote_app_id ,
877+ remote_app_info : context. remote_app_info ,
872878 attestation : context. attestation ,
873879 state : context. state . clone ( ) ,
874880 } )
0 commit comments