@@ -73,18 +73,6 @@ impl AttestationType {
7373 }
7474 }
7575
76- // pub fn parse_from_str(input: &str) -> Result<Self, AttestationError> {
77- // match input {
78- // "none" => Ok(Self::None),
79- // "dummy" => Ok(Self::Dummy),
80- // "azure-tdx" => Ok(Self::AzureTdx),
81- // "qemu-tdx" => Ok(Self::QemuTdx),
82- // "dcap-tdx" => Ok(Self::DcapTdx),
83- // "gcp-tdx" => Ok(Self::GcpTdx),
84- // _ => Err(AttestationError::AttestationTypeNotSupported),
85- // }
86- // }
87-
8876 pub fn get_quote_generator ( & self ) -> Result < Arc < dyn QuoteGenerator > , AttestationError > {
8977 match self {
9078 AttestationType :: None => Ok ( Arc :: new ( NoQuoteGenerator ) ) ,
@@ -122,12 +110,14 @@ pub struct AttestationVerifier {
122110}
123111
124112impl AttestationVerifier {
113+ /// Create an [AttestationVerifier] which will allow no remote attestation
125114 pub fn do_not_verify ( ) -> Self {
126115 Self {
127116 accepted_measurements : Vec :: new ( ) ,
128117 }
129118 }
130119
120+ /// Expect mock measurements used in tests
131121 #[ cfg( test) ]
132122 pub fn mock ( ) -> Self {
133123 Self {
@@ -149,6 +139,7 @@ impl AttestationVerifier {
149139 }
150140 }
151141
142+ /// Verify an attestation, and ensure the measurements match one of our accepted measurements
152143 pub async fn verify_attestation (
153144 & self ,
154145 attestation_payload : AttesationPayload ,
@@ -182,6 +173,7 @@ impl AttestationVerifier {
182173 Ok ( Some ( measurements) )
183174 }
184175
176+ /// Whether we allow no remote attestation
185177 pub fn has_remote_attestion ( & self ) -> bool {
186178 !self . accepted_measurements . is_empty ( )
187179 }
0 commit comments