hellhound/assertion
Standalone signed JWT assertions. No discovery, network or implicit clock.
Registered claims are optional here; the caller’s protocol profile decides
which are required. Custom JSON claims cannot replace registered claims.
Material is redacted during ordinary inspection; to_string exposes the
compact credential deliberately. This module does not issue checked identity.
Types
Protected header options. None omits kid/typ, including a JWK’s own kid.
alg is always derived from the explicit compatible algorithm.
pub type Options {
Options(
algorithm: config.SigningAlgorithm,
key_id: option.Option(String),
token_type: option.Option(String),
)
}
Constructors
-
Options( algorithm: config.SigningAlgorithm, key_id: option.Option(String), token_type: option.Option(String), )
Values
pub fn options(algorithm: config.SigningAlgorithm) -> Options
pub fn sign(
claims: Claims,
key: config.SigningKey,
algorithm: config.SigningAlgorithm,
) -> Result(Assertion, SignError)
Sign with typ JWT and the key’s identifier, when present.
pub fn sign_with_options(
claims: Claims,
key: config.SigningKey,
options: Options,
) -> Result(Assertion, SignError)
pub fn to_string(assertion: Assertion) -> String
Expose the compact credential for deliberate transmission. Do not log it.
pub fn with_claim(
claims: Claims,
name: String,
value: json.Json,
) -> Claims
Add a custom JSON claim. Registered names and duplicate custom names make
this Claims value invalid; sign returns the first construction error.
pub fn with_expiration(
claims: Claims,
expires_at: timestamp.Timestamp,
) -> Claims
NumericDates use whole Unix seconds. No system clock is read.
pub fn with_issued_at(
claims: Claims,
issued_at: timestamp.Timestamp,
) -> Claims
pub fn with_not_before(
claims: Claims,
not_before: timestamp.Timestamp,
) -> Claims