Struct sd_jwt_payload::SdObjectDecoder
source · pub struct SdObjectDecoder { /* private fields */ }Expand description
Substitutes digests in an SD-JWT object by their corresponding plain text values provided by disclosures.
Implementations§
source§impl SdObjectDecoder
impl SdObjectDecoder
sourcepub fn new_with_sha256() -> Self
pub fn new_with_sha256() -> Self
Creates a new SdObjectDecoder with sha-256 hasher.
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SdObjectDecoder without any hashers.
sourcepub fn add_hasher(&mut self, hasher: Box<dyn Hasher>) -> Option<Box<dyn Hasher>>
pub fn add_hasher(&mut self, hasher: Box<dyn Hasher>) -> Option<Box<dyn Hasher>>
Adds a hasher.
If a hasher for the same algorithm Hasher::alg_name already exists, it will be replaced and
the existing hasher will be returned, otherwise None.
sourcepub fn remove_hasher(&mut self, hash_alg: String) -> Option<Box<dyn Hasher>>
pub fn remove_hasher(&mut self, hash_alg: String) -> Option<Box<dyn Hasher>>
Removes a hasher.
If the hasher for that algorithm exists, it will be removed and returned, otherwise None.
sourcepub fn decode(
&self,
object: &Map<String, Value>,
disclosures: &Vec<String>
) -> Result<Map<String, Value>, Error>
pub fn decode( &self, object: &Map<String, Value>, disclosures: &Vec<String> ) -> Result<Map<String, Value>, Error>
Decodes an SD-JWT object containing by Substituting the digests with their corresponding
plain text values provided by disclosures.
§Notes
- The hasher is determined by the
_sd_algproperty. If none is set, the sha-256 hasher will be used, if present. - Claims like
exporiatare not validated in the process of decoding. _sd_algproperty will be removed if present.
pub fn determine_hasher( &self, object: &Map<String, Value> ) -> Result<&dyn Hasher, Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SdObjectDecoder
impl !RefUnwindSafe for SdObjectDecoder
impl Send for SdObjectDecoder
impl Sync for SdObjectDecoder
impl Unpin for SdObjectDecoder
impl !UnwindSafe for SdObjectDecoder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more