Skip to content

Commit

Permalink
improve example
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulmth committed Jan 8, 2024
1 parent 5c4a8fc commit b44be04
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions examples/sd_jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,14 @@ fn main() -> Result<(), Box<dyn Error>> {
]
});

let mut disclosures: Vec<Disclosure> = vec![];
let mut encoder: SdObjectEncoder = object.try_into()?;
let disclosure = encoder.conceal(&["email"], None)?;
disclosures.push(disclosure);
let disclosure = encoder.conceal(&["phone_number"], None)?;
disclosures.push(disclosure);
let disclosure = encoder.conceal(&["address", "street_address"], None)?;
disclosures.push(disclosure);
let disclosure = encoder.conceal(&["address"], None)?;
disclosures.push(disclosure);
let disclosure = encoder.conceal_array_entry(&["nationalities"], 0, None)?;
disclosures.push(disclosure);
let disclosures: Vec<Disclosure> = vec![
encoder.conceal(&["email"], None)?,
encoder.conceal(&["phone_number"], None)?,
encoder.conceal(&["address", "street_address"], None)?,
encoder.conceal(&["address"], None)?,
encoder.conceal_array_entry(&["nationalities"], 0, None)?,
];
encoder.add_sd_alg_property();

println!("encoded object: {}", serde_json::to_string_pretty(encoder.object())?);
Expand Down

0 comments on commit b44be04

Please sign in to comment.