pub struct CwtMeta {
pub issuer: Option<String>,
pub subject: Option<String>,
pub expires_at: Option<i64>,
pub not_before: Option<i64>,
pub issued_at: Option<i64>,
}Expand description
CWT (CBOR Web Token) standard claims metadata
These are standard CWT claims defined outside of Claim 169, extracted from the CWT payload for convenience.
Fields§
§issuer: Option<String>Issuer (CWT claim 1) - Identifier of the entity issuing the credential
subject: Option<String>Subject (CWT claim 2) - Identifier of the subject of the credential
expires_at: Option<i64>Expiration Time (CWT claim 4) - Unix timestamp when credential expires
not_before: Option<i64>Not Before (CWT claim 5) - Unix timestamp before which credential is invalid
issued_at: Option<i64>Issued At (CWT claim 6) - Unix timestamp when credential was issued
Implementations§
Source§impl CwtMeta
impl CwtMeta
pub fn new() -> Self
pub fn with_issuer(self, issuer: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_expires_at(self, expires_at: i64) -> Self
pub fn with_not_before(self, not_before: i64) -> Self
pub fn with_issued_at(self, issued_at: i64) -> Self
Sourcepub fn is_time_valid(&self, current_time: i64) -> bool
pub fn is_time_valid(&self, current_time: i64) -> bool
Check if the credential is currently valid based on timestamps
Sourcepub fn is_expired(&self, current_time: i64) -> bool
pub fn is_expired(&self, current_time: i64) -> bool
Check if the credential is expired
Sourcepub fn is_not_yet_valid(&self, current_time: i64) -> bool
pub fn is_not_yet_valid(&self, current_time: i64) -> bool
Check if the credential is not yet valid
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CwtMeta
impl<'de> Deserialize<'de> for CwtMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CwtMeta
impl StructuralPartialEq for CwtMeta
Auto Trait Implementations§
impl Freeze for CwtMeta
impl RefUnwindSafe for CwtMeta
impl Send for CwtMeta
impl Sync for CwtMeta
impl Unpin for CwtMeta
impl UnwindSafe for CwtMeta
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