Skip to main content

hyprstream_crypto/
lib.rs

1//! Light, transport-free cryptographic primitives for hyprstream.
2//!
3//! This crate holds the cleanly-separable generic crypto that used to live in
4//! `hyprstream-rpc/src/crypto/`. It carries **no** transport, Cap'n Proto, MoQ,
5//! quinn, or iroh dependencies, so crates that need only crypto (`hyprstream-pds`,
6//! `hyprstream-discovery`, the wasm surface) can depend on it without pulling the
7//! full RPC stack. `hyprstream-rpc` re-exports every module here so existing
8//! `hyprstream_rpc::crypto::…` / `hyprstream_rpc::did_key::…` paths keep working.
9//!
10//! # Modules
11//!
12//! - [`pq`] — ML-DSA-65 (FIPS 204) signatures and ML-KEM-768 (FIPS 203) KEM.
13//! - [`cose_sign`] — COSE composite (EdDSA + ML-DSA-65) sign/verify.
14//! - [`cose_sign1`] — COSE_Sign1 (RFC 9052) single-signer envelopes.
15//! - [`hmac`] — chained-MAC state for streaming response authentication.
16//! - [`backend`] — KDF and MAC backend (Blake3 default, HKDF/HMAC-SHA256 in `fips`).
17//! - [`did_key`] — the single canonical `did:key` / Multikey multibase codec and
18//!   multicodec constants (`ed25519-pub`, `ml-dsa-65-pub`).
19//!
20//! # Feature Flags
21//!
22//! - `fips`: KDF/MAC backend uses HKDF-SHA256 + HMAC-SHA256 (NIST SP 800-56C,
23//!   FIPS 198-1) instead of Blake3.
24
25pub mod backend;
26pub mod cose_sign;
27pub mod cose_sign1;
28pub mod did_key;
29pub mod hmac;
30pub mod pq;
31
32pub use backend::{derive_key, keyed_mac, keyed_mac_truncated, keyed_mac_truncated_parts};
33pub use hmac::StreamHmacState;