Skip to content

Commit

Permalink
Merge pull request #6 from robjsliwa/rel
Browse files Browse the repository at this point in the history
Bumped version and updated README to add example usage for claims def…
  • Loading branch information
robjsliwa committed Jan 29, 2024
2 parents 1fe6494 + e1358d7 commit c4f927e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sdjwt"
version = "0.7.1"
version = "0.7.2"
authors = ["Rob Sliwa <[email protected]>"]
license = "MIT"
readme = "README.md"
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,40 @@ fn main() -> Result<(), Error> {
}
```

Issuer can also create claims using YAML and marking selective disclosures with !sd tag.

Example:
```rust
const ISSUER_CLAIMS_YAML: &str = r#"
sub: user_42
!sd given_name: John
!sd family_name: Doe
email: [email protected]
phone_number: +1-202-555-0101
phone_number_verified: true
address:
!sd street_address: 123 Main St
!sd locality: Anytown
region: Anystate
country: US
birthdate: 1940-01-01
updated_at: 1570000000
nationalities:
- !sd US
- !sd DE
"#;

let (claims, tagged_paths) = parse_yaml(TEST_CLAIMS_YAML)?;
let mut issuer = Issuer::new(claims)?;
let issuer_sd_jwt = issuer
.require_key_binding(Jwk::from_value(holder_jwk)?)
.iter_disclosable(tagged_paths.iter())
.encode(&KeyForEncoding::from_rsa_pem(
issuer_private_key.as_bytes(),
)?)?;
println!("issuer_sd_jwt: {:?}", issuer_sd_jwt);
```

## Holder

The Holder module represents a Holder, presenting SD-JWT including selected disclosures.
Expand Down

0 comments on commit c4f927e

Please sign in to comment.