Sign a summary with an Ed25519 keypair.
(
summary: &BindingAttestationSummary,
keypair: &KeyPair,
)
| 169 | impl SignedAttestationSummary { |
| 170 | /// Sign a summary with an Ed25519 keypair. |
| 171 | pub fn sign( |
| 172 | summary: &BindingAttestationSummary, |
| 173 | keypair: &KeyPair, |
| 174 | ) -> Result<Self, BindingAttestationError> { |
| 175 | let summary_bytes = summary.canonical_summary_bytes()?; |
| 176 | let mut message = |
| 177 | Vec::with_capacity(ATTESTATION_SUMMARY_SIGN_DOMAIN.len() + summary_bytes.len()); |
| 178 | message.extend_from_slice(ATTESTATION_SUMMARY_SIGN_DOMAIN); |
| 179 | message.extend_from_slice(&summary_bytes); |
| 180 | let signature = Signer::new(keypair).sign(&message); |
| 181 | Ok(Self { |
| 182 | summary_bytes, |
| 183 | signature: *signature.as_bytes(), |
| 184 | }) |
| 185 | } |
| 186 | |
| 187 | /// Decode and validate signed summary bytes. |
| 188 | pub fn decode(bytes: &[u8]) -> Result<Self, BindingAttestationError> { |
nothing calls this directly
no test coverage detected