1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! HMAC secret fixtures built on `uselesskey-core`.
//!
//! Generates HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512 symmetric secrets
//! for testing. Supports deterministic and random modes.
//!
//! # Usage
//!
//! The main entry point is the [`HmacFactoryExt`] trait, which adds the `.hmac()` method
//! to [`Factory`](uselesskey_core::Factory).
//!
//! # Examples
//!
//! ```
//! use uselesskey_core::Factory;
//! use uselesskey_hmac::{HmacFactoryExt, HmacSpec};
//!
//! let fx = Factory::random();
//! let kp = fx.hmac("my-service", HmacSpec::hs256());
//! let secret = kp.secret_bytes();
//! assert_eq!(secret.len(), 32);
//! ```
//!
//! # Deterministic Mode
//!
//! Use deterministic mode for reproducible test fixtures:
//!
//! ```
//! use uselesskey_core::{Factory, Seed};
//! use uselesskey_hmac::{HmacFactoryExt, HmacSpec};
//!
//! let seed = Seed::from_env_value("test-seed").unwrap();
//! let fx = Factory::deterministic(seed);
//!
//! // Same seed + label + spec = same secret
//! let s1 = fx.hmac("issuer", HmacSpec::hs384());
//! let s2 = fx.hmac("issuer", HmacSpec::hs384());
//! assert_eq!(s1.secret_bytes(), s2.secret_bytes());
//!
//! // Different labels produce different secrets
//! let s3 = fx.hmac("other", HmacSpec::hs384());
//! assert_ne!(s1.secret_bytes(), s3.secret_bytes());
//! ```
//!
//! # Available Specs
//!
//! | Spec | Algorithm | Secret Length |
//! |------|-----------|--------------|
//! | [`HmacSpec::hs256()`] | HMAC-SHA256 | 32 bytes |
//! | [`HmacSpec::hs384()`] | HMAC-SHA384 | 48 bytes |
//! | [`HmacSpec::hs512()`] | HMAC-SHA512 | 64 bytes |
pub use ;
pub use HmacSpec;