Verify an attestation under this policy, failing closed on every refusal path (see the type docs).
(&self, attestation: &Attestation)
| 1133 | /// Verify an attestation under this policy, failing closed on every |
| 1134 | /// refusal path (see the type docs). |
| 1135 | pub fn verify(&self, attestation: &Attestation) -> Result<(), AttestationError> { |
| 1136 | let Some(_signature) = &attestation.signature else { |
| 1137 | return Err(AttestationError::Unsigned); |
| 1138 | }; |
| 1139 | let Some(signer) = attestation.signer.as_deref() else { |
| 1140 | return Err(AttestationError::Unsigned); |
| 1141 | }; |
| 1142 | |
| 1143 | if signer.starts_with("session-mac:") { |
| 1144 | return Err(AttestationError::SessionMacSignerNotTrusted { |
| 1145 | signer: signer.to_string(), |
| 1146 | }); |
| 1147 | } |
| 1148 | |
| 1149 | let Some(public_key) = self.trusted.get(signer) else { |
| 1150 | return Err(AttestationError::SignerNotTrusted { |
| 1151 | signer: signer.to_string(), |
| 1152 | }); |
| 1153 | }; |
| 1154 | |
| 1155 | if !attestation.verify_with_did(public_key) { |
| 1156 | return Err(AttestationError::SignatureVerificationFailed { |
| 1157 | signer: signer.to_string(), |
| 1158 | }); |
| 1159 | } |
| 1160 | |
| 1161 | Ok(()) |
| 1162 | } |
| 1163 | } |
| 1164 | |
| 1165 | // Error Type |
no test coverage detected