Skip to main content

Module cose

Module cose 

Source
Expand description

Production signer/verifier adapters over hyprstream_rpc::crypto::cose_sign, mirroring crate::mac::compiled::cose.

S8 (#574): the signer is policy-aware. Construct it via [CoseAuditSigner::new] with the node’s enforced CryptoPolicy. Under a Hybrid policy it FAILS CLOSED at sign time if no ML-DSA-65 key is provisioned — an audit record is a security-critical accounting artifact and silently emitting an Ed25519-only signature under a Hybrid policy would be an in-band downgrade. The construction is the hybrid nested COSE composite; the key management is the caller’s job (the node provisions the PQ audit key from the same MlDsaSigningKeyStore the token mint uses).

Structs§

CoseAuditSigner
Hybrid (EdDSA + ML-DSA-65) signer for audit records, policy-aware.
CoseAuditVerifier
Hybrid verifier. require_pq = true enforces the ML-DSA outer layer.
OwnedCoseAuditSigner
Owned-key variant of CoseAuditSigner (B2, #674): production wiring stores this on OAuthState/AuditedAvc, both of which must be 'static — a borrowed signer cannot live there. Holds Arcs to the same key material a borrowed CoseAuditSigner would reference (a startup-time snapshot of the node’s active EdDSA + ML-DSA-65 keys), and signs with the IDENTICAL fail-closed logic: under Hybrid, a missing PQ key fails every sign call rather than downgrading.

Constants§

AUDIT_AAD
Domain-separation AAD for audit-record signatures (distinct from policy/envelope AADs so an audit signature can never be replayed as another message type).