#[non_exhaustive]pub struct KeyBinding {
pub audience: String,
pub nonce: String,
pub issued_at: i64,
pub additional: IndexMap<String, Value>,
}Available on crate feature
sd-jwt only.Expand description
What a key binding JWT asserts (RFC 9901 §4.3): the verifier it is for, the nonce of the
transaction and when it was made; sd_hash is computed when the SD-JWT is signed.
§Examples
use chrono::{TimeZone as _, Utc};
use identity_kit::sd_jwt_vc::KeyBinding;
let binding = KeyBinding::new(
"https://verifier.example.org",
"1234567890",
Utc.timestamp_opt(1748536865, 0).unwrap(),
);
let claims = binding.claims("fMV05vuMARs3uG0Dg0BYd_7mQR9EGBkRof0cTZyuqXE".to_owned());
assert_eq!(claims.iat, Some(1748536865));
assert_eq!(claims.additional["nonce"], "1234567890");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.audience: Stringaud: the verifier the presentation is for.
nonce: Stringnonce: the value binding the presentation to the transaction.
issued_at: i64iat: when the key binding JWT is issued.
additional: IndexMap<String, Value>Further claims.
Implementations§
Source§impl KeyBinding
impl KeyBinding
Sourcepub fn new(
audience: impl Into<String>,
nonce: impl Into<String>,
issued_at: DateTime<Utc>,
) -> Self
pub fn new( audience: impl Into<String>, nonce: impl Into<String>, issued_at: DateTime<Utc>, ) -> Self
A key binding for audience with nonce, issued at issued_at.
Trait Implementations§
Source§impl Clone for KeyBinding
impl Clone for KeyBinding
Source§impl Debug for KeyBinding
impl Debug for KeyBinding
impl Eq for KeyBinding
Source§impl PartialEq for KeyBinding
impl PartialEq for KeyBinding
impl StructuralPartialEq for KeyBinding
Auto Trait Implementations§
impl Freeze for KeyBinding
impl RefUnwindSafe for KeyBinding
impl Send for KeyBinding
impl Sync for KeyBinding
impl Unpin for KeyBinding
impl UnsafeUnpin for KeyBinding
impl UnwindSafe for KeyBinding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.