Struct SdJwt
pub struct SdJwt { /* private fields */ }Expand description
A parsed SD-JWT presentation.
Keeps the exact strings it was parsed from alongside the decoded values. Spec §6.1 binds each layer to “the serialized form as received”, so re-encoding from the decoded header and payload would not reproduce the bytes a binding covers.
Implementations§
Source§impl SdJwt
impl SdJwt
Sourcepub fn parse(serialized: &str) -> Result<SdJwt, ViError>
pub fn parse(serialized: &str) -> Result<SdJwt, ViError>
Parse a serialized SD-JWT, decoding the JWT segments and every disclosure.
Sourcepub fn issuer_jwt(&self) -> &str
pub fn issuer_jwt(&self) -> &str
The issuer-signed JWT, exactly as received.
Sourcepub fn payload(&self) -> &Value
pub fn payload(&self) -> &Value
The decoded JWT payload, before any disclosure is resolved into it.
Sourcepub fn disclosures(&self) -> &[String]
pub fn disclosures(&self) -> &[String]
The presented disclosures, in the order they were received.
Sourcepub fn disclosure_values(&self) -> &[Disclosure]
pub fn disclosure_values(&self) -> &[Disclosure]
The decoded disclosures, positionally matching Self::disclosures.
Sourcepub fn key_binding_jwt(&self) -> Option<&str>
pub fn key_binding_jwt(&self) -> Option<&str>
The key-binding JWT, when the presentation carried one.
Sourcepub fn serialize(&self) -> String
pub fn serialize(&self) -> String
Re-serialize exactly what was parsed, key-binding JWT included.
Sourcepub fn presentation(&self) -> String
pub fn presentation(&self) -> String
The presentation a hash binding covers: every disclosure, a trailing
~, and no key-binding JWT.
§6.1 computes sd_hash over the SD-JWT excluding the KB-JWT, so this
is a named operation rather than a convention a caller has to remember.
Sourcepub fn selective_presentation(
&self,
indices: &[usize],
) -> Result<String, ViError>
pub fn selective_presentation( &self, indices: &[usize], ) -> Result<String, ViError>
The presentation containing only the disclosures at indices.
§5.4 and §6.1.2: an L3 binds to the L2 subset forwarded to its own recipient, not to everything the agent holds.
Sourcepub fn resolve_disclosures(&self) -> Result<Map<String, Value>, ViError>
pub fn resolve_disclosures(&self) -> Result<Map<String, Value>, ViError>
Resolve the presented disclosures into the payload’s claim set.
Two separate rules, matching the reference:
- Object-property disclosures resolve only when their hash appears in
_sd. An array-element disclosure listed there resolves to nothing, because it has no name to bind to. delegate_payloadreferences resolve against every presented disclosure, ungated by_sd. A reference whose disclosure is absent stays a{"...": "<hash>"}object so the caller can tell resolved from unresolved.
Nested references inside constraint objects are deliberately left alone; the reference does not recurse into them either.
Trait Implementations§
impl Eq for SdJwt
impl StructuralPartialEq for SdJwt
Auto Trait Implementations§
impl Freeze for SdJwt
impl RefUnwindSafe for SdJwt
impl Send for SdJwt
impl Sync for SdJwt
impl Unpin for SdJwt
impl UnsafeUnpin for SdJwt
impl UnwindSafe for SdJwt
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more