Skip to main content

Crate hyprstream_crypto

Crate hyprstream_crypto 

Source
Expand description

Light, transport-free cryptographic primitives for hyprstream.

This crate holds the cleanly-separable generic crypto that used to live in hyprstream-rpc/src/crypto/. It carries no transport, Cap’n Proto, MoQ, quinn, or iroh dependencies, so crates that need only crypto (hyprstream-pds, hyprstream-discovery, the wasm surface) can depend on it without pulling the full RPC stack. hyprstream-rpc re-exports every module here so existing hyprstream_rpc::crypto::… / hyprstream_rpc::did_key::… paths keep working.

§Modules

  • pq — ML-DSA-65 (FIPS 204) signatures and ML-KEM-768 (FIPS 203) KEM.
  • cose_sign — COSE composite (EdDSA + ML-DSA-65) sign/verify.
  • cose_sign1 — COSE_Sign1 (RFC 9052) single-signer envelopes.
  • hmac — chained-MAC state for streaming response authentication.
  • backend — KDF and MAC backend (Blake3 default, HKDF/HMAC-SHA256 in fips).
  • did_key — the single canonical did:key / Multikey multibase codec and multicodec constants (ed25519-pub, ml-dsa-65-pub).

§Feature Flags

  • fips: KDF/MAC backend uses HKDF-SHA256 + HMAC-SHA256 (NIST SP 800-56C, FIPS 198-1) instead of Blake3.

Re-exports§

pub use backend::derive_key;
pub use backend::keyed_mac;
pub use backend::keyed_mac_truncated;
pub use backend::keyed_mac_truncated_parts;
pub use hmac::StreamHmacState;

Modules§

backend
Cryptographic backend abstraction for KDF and MAC operations.
cose_sign
Nested-COSE hybrid composite signing for the hyprstream SignedEnvelope (EdDSA + ML-DSA-65).
cose_sign1
COSE_Sign1 (RFC 9052) detached-payload signing for the hyprstream SignedEnvelope.
did_key
Shared did:key (Ed25519) ⇄ raw-key codec.
hmac
Stream block HMAC for authenticating streaming responses.
pq
Post-quantum hybrid cryptographic primitives (ML-DSA-65 + ML-KEM-768).