Skip to main content

SessionRequest

Struct SessionRequest 

Source
pub struct SessionRequest { /* private fields */ }
Expand description

SessionRequest

An unsigned request with 1–16 unique sorted scopes and an optional nonzero TTL. The scope bound implies at most 1024 label bytes. Constructing or hashing this value does not grant scopes, authenticate a credential or admit its lifetime.

Implementations§

Source§

impl SessionRequest

Source

pub fn new( scopes: Vec<String>, ttl_secs: Option<u64>, ) -> Result<Self, SessionRequestError>

Admit count, then grammar in input order, then duplicates and nonzero TTL.

Scope order is normalized. Positive TTLs, including those above the protocol ceiling, retain their exact identity until host-policy evaluation.

Source

pub fn scopes(&self) -> &[ScopeLabel]

Borrow normalized scopes; their inclusion still needs a verified grant.

Source

pub const fn ttl_secs(&self) -> Option<u64>

Exact submitted lifetime, preserving absence independently of host defaults.

Source

pub fn hash(&self) -> [u8; 32]

Compute the existing V1 request identity without allocating encoded bytes.

Domain bytes have no terminator. Counts, label lengths and the optional TTL use big-endian u64; the TTL presence tag is one byte. This is a request fingerprint, never a signed credential or authorization token.

Source

pub fn expires_at_ns( &self, now_ns: u64, policy: SessionTtlPolicy, ) -> Result<u64, SessionRequestError>

Compute the requested deadline from a trusted host time and policy.

Reject over-limit TTLs and overflow. The receiver must additionally cap this deadline by login and authority expiry. Current enrollment is independently required for using the session.

Source

pub fn evaluate_grants( &self, grants: &[DelegatedRoleGrant], role: &AuthRole, now_ns: u64, policy: SessionTtlPolicy, ) -> Result<u64, SessionRequestError>

Check narrowing to one protected role, then calculate the requested deadline.

This is cheap request preflight, not proof verification or session admission. Grants must be bounded, strictly ordered and unique; they are never sorted. Other roles cannot supply missing scopes. The host owns role, time and TTL policy. Signature, fresh-claims aggregate bounds, current authority, replay, revocation, enrollment freshness and the login and authority lease caps remain separate.

Trait Implementations§

Source§

impl Clone for SessionRequest

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SessionRequest

Source§

impl PartialEq for SessionRequest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SessionRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.