Skip to main content

CardRefScope

Struct CardRefScope 

Source
pub struct CardRefScope(/* private fields */);
Expand description

A principal’s card authorization set.

Authorization is identity-based on (kind, name, version). The optional resolved uid is ignored.

Implementations§

Source§

impl CardRefScope

Source

pub fn as_slice(&self) -> &[CardRef]

Borrow scope members.

Source

pub fn is_empty(&self) -> bool

Whether the scope has no members.

Source

pub fn len(&self) -> usize

Number of scope members.

Source

pub fn from_root_and_members( root: &CardRef, members: impl IntoIterator<Item = CardRef>, ) -> CardRefScope

Build a scope and guarantee that root is the first member.

Duplicate identity (same (kind, name, version), ignoring uid) is removed. Root is always retained as the first element.

A duplicate that carries a resolved uid donates it to the retained entry. Mint resolves each scope member against the tenant-local registry while its callers still hold the authored, UID-less root, so without this the resolved root identity would be dropped and ingest could not stamp subject_card_uid from signed claims alone.

Source

pub fn own(root: &CardRef) -> CardRefScope

Build an own-card-only scope.

Passing this as card_ref_scope on issuance is the canonical way to express “this token is scoped only to its own card.” An empty card_ref_scope on a received wire token carries the same meaning and is upgraded to own by the verifier’s seed_scope call.

Source

pub fn permits_root(&self, root: &CardRef) -> bool

True when the scope is empty (vacuously) or contains the root card.

An empty scope is permitted because the wire format omits the scope field for own-scoped tokens and the verifier upgrades it to own(root) via seed_scope. If you need a stricter guarantee that the root was explicitly present at construction time, use authorizes on a non-empty scope.

Source

pub fn authorizes(&self, card: &CardRef) -> bool

Return true when card is authorized by identity.

Source

pub fn uids(&self) -> Vec<CardUid>

The resolved UIDs of this scope’s members, in member order.

This is the set a row’s subject_card_uid correlation is authorized against: the UIDs the mint signed onto the scope. A member without a resolved UID contributes none, so no row can correlate to it.

Trait Implementations§

Source§

impl Clone for CardRefScope

Source§

fn clone(&self) -> CardRefScope

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 CardRefScope

Source§

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

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

impl Default for CardRefScope

Source§

fn default() -> CardRefScope

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CardRefScope

Source§

fn deserialize<D>( deserializer: D, ) -> Result<CardRefScope, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for CardRefScope

Source§

impl PartialEq for CardRefScope

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for CardRefScope

Serializes as a JSON array of Display strings ("Kind/name@version").

This is the canonical wire encoding for card_ref_scope members in JWT claims and HTTP payloads. Individual card_ref fields use an object shape instead — this asymmetry exists because scope members are positional (root-first) and compact by design. An empty array means “own-card scope”; the verifier upgrades it to own(root) via seed_scope.

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CardRefScope

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?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