uselesskey-token
Token-shaped fixtures for tests, built on uselesskey-core.
Generates deterministic or random token strings so authorization code paths can be tested without committing secret-looking blobs.
Part of the uselesskey workspace. Use
the facade crate for the simplest experience, or depend on this crate directly
for minimal compile time.
What It Provides
- API-key style tokens:
uk_test_<base62> - Opaque bearer tokens: base64url data
- OAuth access tokens in JWT shape:
header.payload.signature
Usage
use Factory;
use ;
let fx = random;
let api_key = fx.token;
let bearer = fx.token;
let oauth = fx.token;
assert!;
assert!;
assert_eq!;
Deterministic Mode
use ;
use ;
let seed = from_env_value.unwrap;
let fx = deterministic;
// Same seed + label + spec = same token
let t1 = fx.token;
let t2 = fx.token;
assert_eq!;
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
See the uselesskey crate for full
documentation.