#[non_exhaustive]pub struct Claims {
pub sub: UserId,
pub device: DeviceId,
pub binding: DeviceBinding,
pub issued_at: i64,
pub expires_at: i64,
pub jti: String,
}Expand description
Verified session claims — what a TokenVerifier::verify returns on success.
Stable shape; new fields land behind #[non_exhaustive]. Timestamps are
unix seconds (signed to leave room for pre-epoch sentinels in tests).
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.sub: UserId§device: DeviceId§binding: DeviceBinding§issued_at: i64§expires_at: i64§jti: StringUnique token id — the key the revocation set is keyed on (R019-F4).
Empty means unset / not individually revocable; sessions minted through
cheers-server’s SessionAuthority get a fresh value via
with_jti. #[serde(default, skip_serializing_if)]
keeps the wire format byte-identical to a pre-jti token when unset —
important for the mesofact cookie contract.
Implementations§
Source§impl Claims
impl Claims
pub fn new( sub: UserId, device: DeviceId, binding: DeviceBinding, issued_at: i64, expires_at: i64, ) -> Self
Sourcepub fn with_jti(self, jti: impl Into<String>) -> Self
pub fn with_jti(self, jti: impl Into<String>) -> Self
Attach a jti (the revocation key). Builder-style so existing
five-arg new call sites are unaffected.
Sourcepub fn is_expired_at(&self, now: i64) -> bool
pub fn is_expired_at(&self, now: i64) -> bool
true if expires_at is at or before now (unix seconds).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Claims
impl<'de> Deserialize<'de> for Claims
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 Claims
impl StructuralPartialEq for Claims
Auto Trait Implementations§
impl Freeze for Claims
impl RefUnwindSafe for Claims
impl Send for Claims
impl Sync for Claims
impl Unpin for Claims
impl UnsafeUnpin for Claims
impl UnwindSafe for Claims
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