Skip to main content

bh_sd_jwt/
lib.rs

1// Copyright (C) 2020-2026  The Blockhouse Technology Limited (TBTL).
2//
3// This program is free software: you can redistribute it and/or modify it
4// under the terms of the GNU Affero General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or (at your
6// option) any later version.
7//
8// This program is distributed in the hope that it will be useful, but
9// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
11// License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16#![deny(missing_docs)]
17#![deny(rustdoc::broken_intra_doc_links)]
18
19//! This crate implements Selective Disclosure JSON Web Tokens.
20//!
21//! It provides functionality to create, sign, and verify JWTs that support selective disclosure of
22//! claims, in accordance with emerging IETF drafts: [Selective Disclosure for JWTs (SD-JWT)][1] &
23//! [SD-JWT-based Verifiable Credentials (SD-JWT VC)][2].
24//!
25//! [1]: <https://datatracker.ietf.org/doc/html/draft-ietf-oauth-selective-disclosure-jwt>
26//! [2]: <https://datatracker.ietf.org/doc/html/draft-ietf-oauth-sd-jwt-vc>
27//!
28//! # Details
29//!
30//! The main components of this crate are the following.
31//!
32//! * [`issuer`] -- Constructs and signs JWTs with standard and custom claims.
33//! * [`holder`] -- Imports, manages, and presents SD-JWT credentials with selective disclosure.
34//! * [`verifier`] -- Validates JWT signatures, claim integrity, and key binding challenges.
35//! * [`lookup`] -- Provides different methods of retrieving an issuer’s public key.
36//!
37//! # Examples
38//!
39//! The `bh-sd-jwt` repository contains [the full examples][examples], so you should take a look
40//! there to see how things fit together.
41//!
42//! [examples]: <https://github.com/blockhousetech/eudi-rust-core/tree/main/bh-sd-jwt/examples>
43
44// Re-export the `bh-jws-utils` crate
45pub use bh_jws_utils;
46pub use error::{Error, FormatError, Result, SignatureError};
47use sd_jwt::SdJwt;
48
49mod error;
50mod key_binding;
51mod models;
52mod sd_jwt;
53#[cfg(test)]
54mod test_utils;
55mod traits;
56mod utils;
57
58mod decoder;
59mod encoder;
60pub mod holder;
61pub mod issuer;
62pub mod lookup;
63pub mod verifier;
64
65pub use iref;
66pub use issuer::{IssuerJwt, IssuerJwtHeader};
67pub use key_binding::KeyBindingChallenge;
68pub use models::*;
69pub use sd_jwt::SdJwtKB;
70pub use traits::*;