MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / sign

Method sign

atomic-repository/src/git_binding/summary.rs:171–185  ·  view source on GitHub ↗

Sign a summary with an Ed25519 keypair.

(
        summary: &BindingAttestationSummary,
        keypair: &KeyPair,
    )

Source from the content-addressed store, hash-verified

169impl 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> {

Callers

nothing calls this directly

Calls 3

lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected