Expand description
SD-JWT (Selective Disclosure JWT) implementation.
Implements the IETF SD-JWT specification (draft-ietf-oauth-selective-disclosure-jwt) for creating JWTs whose claims can be selectively disclosed by the holder.
§Architecture
- Issuer: Creates an SD-JWT with selectively disclosable claims hashed into
the
_sdarray. Each claim becomes a separate disclosure. - Holder: Receives the full SD-JWT and can present a subset of disclosures to a verifier, revealing only the claims they choose.
- Verifier: Validates the JWT signature and reconstructs disclosed claims
by matching disclosure hashes against the
_sdarray.
§Example
use auth_framework::protocols::sd_jwt::{SdJwtIssuer, SdJwtConfig};
let config = SdJwtConfig::default();
let issuer = SdJwtIssuer::new(config);
let mut claims = serde_json::Map::new();
claims.insert("sub".into(), serde_json::json!("user-42"));
claims.insert("email".into(), serde_json::json!("user@example.com"));
// "email" is selectively disclosable; "sub" stays in the clear
let sd_jwt = issuer.issue(
&claims,
&["email"],
"signing-secret-key",
).unwrap();Structs§
- Disclosure
- A single disclosure: the base64url-encoded
[salt, claim_name, claim_value]array. - SdJwt
- The issued SD-JWT: a compact JWT, the tilde-separated disclosures, and an optional key-binding JWT.
- SdJwt
Config - Configuration for SD-JWT operations.
- SdJwt
Issuer - SD-JWT issuer: creates SD-JWTs with selectively disclosable claims.
- SdJwt
Verifier - SD-JWT verifier: validates SD-JWTs and reconstructs disclosed claims.
- Verified
SdJwt - Result of verifying an SD-JWT.
Enums§
- SdHash
Algorithm - Hash algorithm used for disclosure digests.