uselesskey-hmac
HMAC secret fixtures for testing — generates deterministic or random symmetric secrets for HS256, HS384, and HS512 workflows.
Part of the uselesskey workspace. Use
the facade crate for the simplest experience, or depend on this crate directly
for minimal compile time.
Usage
use Factory;
use ;
let fx = random;
let secret = fx.hmac;
assert_eq!;
Specs
| Constructor | Algorithm | Secret Length |
|---|---|---|
HmacSpec::hs256() |
HMAC-SHA256 | 32 bytes |
HmacSpec::hs384() |
HMAC-SHA384 | 48 bytes |
HmacSpec::hs512() |
HMAC-SHA512 | 64 bytes |
Deterministic Mode
use ;
use ;
let seed = from_env_value.unwrap;
let fx = deterministic;
// Same seed + label + spec = same secret
let s1 = fx.hmac;
let s2 = fx.hmac;
assert_eq!;
Features
| Feature | Description |
|---|---|
jwk |
Octet JWK/JWKS output via uselesskey-jwk |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
See the uselesskey crate for full
documentation.