Skip to main content

Crate hessra_sdk

Crate hessra_sdk 

Source
Expand description

§Hessra SDK

A Rust client library for interacting with Hessra authentication and authorization services.

The Hessra SDK provides a robust and flexible way to request and verify both identity tokens and authorization tokens for protected resources. Authentication can be done via mutual TLS (mTLS) or using identity tokens for most operations.

This crate combines functionality from:

  • hessra-token: Authorization token verification and attestation
  • hessra-token-identity: Identity token creation, verification, and delegation
  • hessra-config: Configuration management
  • hessra-api: HTTP client for the Hessra service

§Features

  • Flexible configuration: Load configuration from various sources (environment variables, files, etc.)
  • Protocol support: HTTP/1.1 support with optional HTTP/3 via feature flag
  • Dual authentication: Support for both mTLS and identity token authentication
  • Identity tokens: Hierarchical, delegatable identity tokens for authentication
  • Authorization tokens: Request and verify authorization tokens for resources
  • Local verification: Retrieve and store public keys for offline token verification
  • Service chains: Support for service chain attestation and verification

§Feature Flags

  • http3: Enables HTTP/3 protocol support
  • toml: Enables configuration loading from TOML files
  • wasm: Enables WebAssembly support for token verification

Structs§

AuthorizationVerifier
Builder for verifying Hessra authorization tokens with flexible configuration.
Biscuit
This structure represents a valid Biscuit token
Hessra
Unified SDK for Hessra authentication services
HessraBuilder
Builder for Hessra SDK instances
HessraClientBuilder
Builder for creating Hessra clients
HessraConfig
Configuration for Hessra SDK client
IdentityTokenRequest
Request for minting a new identity token
IdentityTokenResponse
Response from identity token operations
MintIdentityTokenRequest
Request for minting a new domain-restricted identity token
MintIdentityTokenResponse
Response from minting a domain-restricted identity token
PublicKeyResponse
Response from a public key request
RefreshIdentityTokenRequest
Request for refreshing an existing identity token
ServiceChain
A chain of service nodes
ServiceChainBuilder
Builder for a service chain
ServiceNode
SignTokenRequest
Request structure for token signing operations
SignTokenResponse
Response structure for token signing operations
SignoffInfo
Information about required signoffs for multi-party tokens
StubTokenRequest
Request to mint a stub token that requires prefix attestation before use.
StubTokenResponse
Response from minting a stub token.
TokenRequest
Request payload for requesting an authorization token
TokenResponse
Enhanced token response that may include pending signoffs
VerifyServiceChainTokenRequest
Request payload for verifying a service chain token
VerifyTokenRequest
Request payload for verifying an authorization token
VerifyTokenResponse
Response from a token verification operation

Enums§

ApiError
ConfigError
Errors that can occur when working with Hessra configuration
HessraClient
The main Hessra client type providing token request and verification
KeyPair
pair of cryptographic keys used to sign a token’s block
Protocol
Protocol options for Hessra client communication
PublicKey
the public part of a KeyPair
SdkError
Errors that can occur in the Hessra SDK
TokenError
Detailed error type for hessra-token operations with specific failure information

Functions§

add_identity_attenuation_to_token
add_prefix_restriction
Add a prefix restriction to a token
add_prefix_restriction_to_token
Add a prefix restriction to a base64-encoded token string
add_service_node_attestation
Add a service node attestation to a token
create_identity_token
Creates a basic realm identity token (delegatable).
create_short_lived_identity_token
Create a short-lived version of an identity token for just-in-time use
decode_token
Decode a URL-safe base64 encoded token string to binary
encode_token
Encode binary token data to URL-safe base64 string
fetch_ca_cert
Fetch a CA certificate from the Hessra service
fetch_public_key
Fetch a public key from the Hessra service
parse_server_address
Parse a server address string into (host, port) components.
verify_biscuit_local
Verifies a Biscuit authorization token locally without contacting the authorization server.
verify_identity_token
Verifies the token as an identity token. This validates the expiration, the signature of the token, and the identity of the token.
verify_service_chain_biscuit_local