Skip to main content

UrlTokenConfig

Struct UrlTokenConfig 

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

The deployment’s URL-token configuration: keys and the longest lifetime it issues (url_token_ttl, §1.1).

Implementations§

Source§

impl UrlTokenConfig

Source

pub fn new(keys: UrlTokenKeys) -> Self

keys with the default lifetime cap, DEFAULT_TTL_MS (15 minutes).

Source

pub fn with_ttl_ms( keys: UrlTokenKeys, ttl_ms: u64, ) -> Result<Self, UrlTokenConfigError>

keys with an explicit issued-token lifetime cap.

§Errors

UrlTokenConfigError::Ttl for ttl_ms outside 1..=MAX_TTL_MS.

Source

pub fn ttl_ms(&self) -> u64

The issued-token lifetime cap, in milliseconds.

Source

pub fn keys(&self) -> &UrlTokenKeys

The signing and verification key set.

Source

pub fn mint( &self, audience: &str, repository: &str, target: &UrlTarget, epoch: u64, now_ms: i64, requested_ttl_s: u32, ) -> Result<MintedToken, ServerError>

Mint a token binding audience, repository and target at epoch, issued at now_ms. A requested_ttl_s of 0 asks for the configured lifetime; any request is clamped to it, never refused.

§Errors

internal when the statement cannot encode (a caller’s clock far outside its range).

Source

pub fn precheck( &self, token: &str, now_ms: i64, ) -> Result<Prechecked, TokenRejected>

Verification phase 1, before any repository lookup (SPEC-HTTP-OBJECTS §6): strict token decode, the statement rules, a key id in the verification set (the active key, or a retired key before retired_at_ms + ttl_ms) and the strict Ed25519 signature over blake3(statement).

§Errors

TokenRejected for any failure; the reason never escapes.

Trait Implementations§

Source§

impl Clone for UrlTokenConfig

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 UrlTokenConfig

Source§

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

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

impl TokenGate for UrlTokenConfig

Source§

fn precheck( &self, token: &Redacted, now_ms: i64, ) -> Result<Prechecked, TokenRejected>

Retain a redacted verified statement until visibility is known.
Source§

fn ttl_ms(&self) -> u64

Configured maximum token lifetime, used by stateless binding checks.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more