# uselesskey-hmac
[](https://crates.io/crates/uselesskey-hmac)
[](https://docs.rs/uselesskey-hmac)
[](#license)
HMAC secret fixtures for testing — generates deterministic or random symmetric
secrets for HS256, HS384, and HS512 workflows.
Part of the [`uselesskey`](https://crates.io/crates/uselesskey) workspace. Use
the facade crate for the simplest experience, or depend on this crate directly
for minimal compile time.
## Usage
```rust
use uselesskey_core::Factory;
use uselesskey_hmac::{HmacFactoryExt, HmacSpec};
let fx = Factory::random();
let secret = fx.hmac("issuer", HmacSpec::hs256());
assert_eq!(secret.secret_bytes().len(), 32);
```
### Specs
| `HmacSpec::hs256()` | HMAC-SHA256 | 32 bytes |
| `HmacSpec::hs384()` | HMAC-SHA384 | 48 bytes |
| `HmacSpec::hs512()` | HMAC-SHA512 | 64 bytes |
### Deterministic Mode
```rust
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());
```
## Features
| `jwk` | Octet JWK/JWKS output via `uselesskey-jwk` |
## License
Licensed under either of [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
or [MIT license](https://opensource.org/licenses/MIT) at your option.
See the [`uselesskey` crate](https://crates.io/crates/uselesskey) for full
documentation.