gose
A Gleam JOSE (JSON Object Signing and Encryption) library.
gose/jwa— Algorithm identifiers (RFC 7518)gose/jwe— Encryption (RFC 7516)gose/jwk— Key management (RFC 7517)gose/jws— Digital signatures (RFC 7515)gose/jwt— JSON Web Tokens (RFC 7519)
This module defines GoseError, the shared error type for JWS, JWE, and JWK.
The JWT layer has its own JwtError with richer domain-specific variants.
Types
Error type for JOSE primitive operations (JWS, JWE, JWK).
This is the error type used by low-level JOSE modules. The JWT layer
wraps this via JwtError.JoseError to provide richer domain-specific
error variants for token validation.
pub type GoseError {
ParseError(String)
CryptoError(String)
InvalidState(String)
}
Constructors
-
ParseError(String)Parsing failed - invalid base64, malformed JSON, unexpected structure, etc. The
Stringprovides a human-readable description of what went wrong. -
CryptoError(String)A cryptographic operation failed - signature verification, decryption, key derivation, etc. The
Stringdescribes the failure. -
InvalidState(String)An operation was attempted in an invalid state - wrong key type for the chosen algorithm, missing required header field, etc. The
Stringexplains which invariant was violated.
Values
pub fn error_message(error: GoseError) -> String
Extract the message string from a GoseError, regardless of variant.
Parameters
error- The error to extract the message from.
Returns
The human-readable description string contained in the error variant.