6 releases

0.7.1 Oct 18, 2024
0.7.0 Feb 18, 2024
0.0.6 Jan 22, 2024
0.0.5 Dec 26, 2023

#226 in Authentication

Download history 17/week @ 2024-07-27 22/week @ 2024-08-03 1/week @ 2024-08-10 8/week @ 2024-08-17 9/week @ 2024-08-24 3/week @ 2024-08-31 3/week @ 2024-09-14 7/week @ 2024-09-21 24/week @ 2024-09-28 6/week @ 2024-10-05 100/week @ 2024-10-12 50/week @ 2024-10-19 5/week @ 2024-10-26 2/week @ 2024-11-02 11/week @ 2024-11-09

163 downloads per month

Apache-2.0 OR MIT

98KB
2K SLoC

SD-JWT Rust Reference Implementation

This is the reference implementation of the IETF SD-JWT specification written in Rust. Supported version: 7.

Note: while the project is started as a reference implementation, it is intended to be evolved to a production-ready, high-performance implementations in the long-run.

API

Note: the current version of the crate is 0.0.x, so the API should be considered as experimental. Proposals about API improvements are highly appreciated.

fn demo() {
    let mut issuer = SDJWTIssuer::new(issuer_key, None);
    let sd_jwt = issuer.issue_sd_jwt(claims, ClaimsForSelectiveDisclosureStrategy::AllLevels, holder_key, add_decoy, SDJWTSerializationFormat::Compact).unwrap();

    let mut holder = SDJWTHolder::new(sd_jwt, SDJWTSerializationFormat::Compact).unwrap();
    let presentation = holder.create_presentation(claims_to_disclosure, None, None, None, None).unwrap();

    let verified_claims = SDJWTVerifier::new(presentation, cb_to_resolve_issuer_key, None, None, SDJWTSerializationFormat::Compact).unwrap()
                            .verified_claims;
}

See tests/demos.rs for more details;

Repository structure

SD-JWT Rust crate

SD-JWT crate is the root of the repository.

To build the project simply perform:

cargo build

To run tests:

cargo test

Interoperability testing tool

See Generate tool README document.

External Dependencies

Dual license (MIT/Apache 2.0) dependencies: base64, lazy_static log, serde, serde_json, sha2, rand, hmac, thiserror. MIT license dependencies: jsonwebtoken, strum

Note: the list of dependencies may be changed in the future.

Initial Maintainers

  • Sergey Minaev (Github)
  • DSR Corporation Decentralized Systems Team (Github)

Dependencies

~2–11MB
~138K SLoC