pub struct TokenScope { /* private fields */ }Expand description
Actions a token can authorize.
Implementations§
Source§impl TokenScope
impl TokenScope
Sourcepub const WILDCARD: Self
pub const WILDCARD: Self
Wildcard over channels: authorizes the token’s actions on every
channel, regardless of the token’s channel_hash field. Must be
set explicitly by the issuer — the previous “channel_hash == 0
means wildcard” overload is no longer honored, so a legitimate
channel whose xxh3-truncated ChannelHash happens to hash to 0
cannot accidentally be authorized as a universal grant.
Sourcepub const ALL: Self
pub const ALL: Self
Full access (all actions on a single channel). Does NOT include
Self::WILDCARD — callers that want cross-channel access
must opt in explicitly.
Sourcepub const fn contains(self, other: Self) -> bool
pub const fn contains(self, other: Self) -> bool
Check if this scope includes another.
A scope never “contains” NONE: the bit-mask identity
(self.bits & 0) == 0 would otherwise return true for every
token, so a caller that builds action: TokenScope from
external input — e.g. a wire u32 masked into a smaller
subset — that happens to mask to NONE would receive a
blanket true against any token. Short-circuit NONE so the
caller’s “do they have permission X” question rejects the
no-op action.
Sourcepub const fn intersect(self, other: Self) -> Self
pub const fn intersect(self, other: Self) -> Self
Restrict this scope to only include permissions in other.
Sourcepub fn with_channel(self, channel_hash: ChannelHash) -> ScopedToken
pub fn with_channel(self, channel_hash: ChannelHash) -> ScopedToken
Optional channel hash filter. If set, token only applies to
channels matching this canonical ChannelHash.
Trait Implementations§
Source§impl Clone for TokenScope
impl Clone for TokenScope
Source§fn clone(&self) -> TokenScope
fn clone(&self) -> TokenScope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokenScope
impl Debug for TokenScope
Source§impl PartialEq for TokenScope
impl PartialEq for TokenScope
Source§fn eq(&self, other: &TokenScope) -> bool
fn eq(&self, other: &TokenScope) -> bool
self and other values to be equal, and is used by ==.impl Copy for TokenScope
impl Eq for TokenScope
impl StructuralPartialEq for TokenScope
Auto Trait Implementations§
impl Freeze for TokenScope
impl RefUnwindSafe for TokenScope
impl Send for TokenScope
impl Sync for TokenScope
impl Unpin for TokenScope
impl UnsafeUnpin for TokenScope
impl UnwindSafe for TokenScope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.