Skip to main content

AclEntry

Struct AclEntry 

Source
pub struct AclEntry {
Show 14 fields pub did: String, pub role: Role, pub label: Option<String>, pub allowed_contexts: Vec<String>, pub created_at: u64, pub created_by: String, pub expires_at: Option<u64>, pub kind: ConsumerKind, pub capabilities: Vec<Capability>, pub device: Option<DeviceBinding>, pub version: u32, pub step_up_approver: Option<String>, pub step_up_require: Option<StepUpMode>, pub approve_scope: ApproveScope,
}
Expand description

An entry in the Access Control List.

Fields§

§did: String§role: Role§label: Option<String>§allowed_contexts: Vec<String>§created_at: u64§created_by: String§expires_at: Option<u64>

Unix-epoch seconds at which this entry expires and should be pruned by the background sweeper. None is permanent (existing pre-Phase-2 behavior; entries serialized before this field existed deserialize with this default).

§kind: ConsumerKind

Consumer kind: Companion (user-driven) vs Service (headless). New in M1 (vault-credential-manager design). #[serde(default)] ⇒ pre-M1 rows deserialise as Service { Daemon }.

§capabilities: Vec<Capability>

Fine-grained capability set. Empty Vec on legacy rows; the auth layer falls back to derived_capabilities_for_role when this is empty so existing behaviour stays byte-identical.

§device: Option<DeviceBinding>

Optional Companion/Service device-binding metadata. Populated by the M4 device/register/0.1 flow; absent on legacy rows and on pure ACL entries that don’t represent a registered device.

§version: u32

Optimistic-concurrency version. Incremented on every successful update; the route layer’s If-Match header compares against this and returns 409 Conflict on a stale write. Closes M6 from the May 2026 security review — two admins editing the same DID concurrently no longer silently lose one update.

#[serde(default)] so pre-versioning rows deserialise with version=0. The first update bumps it to 1.

§step_up_approver: Option<String>

VID authorized to ratify an AAL2 step-up for this subject — the recipient the VTA addresses an auth/step-up/approve-request/0.1 to when a gated operation resolves to delegated mode (the holder’s mobile authenticator or browser companion). None means no delegated approver is configured: under a delegated floor the operation fail-closes (the subject can’t self-approve a delegated requirement). Mirrors the spec’s AclEntry.stepUp.approver.

#[serde(default)] so pre-existing rows deserialise as None.

§step_up_require: Option<StepUpMode>

Per-entry step-up override raising the system floor for this subject — the spec’s AclEntry.stepUp.require. ADDITIVE-ONLY: the effective mode is the strictest of (system floor, this override), so an override weaker than the floor is ignored (see StepUpMode::strictest). Restricted to self / delegated (a per-subject override never relaxes to delegated-any); the ACL op layer rejects other values.

#[serde(default)] so pre-existing rows deserialise as None (no override; the system floor applies unchanged).

§approve_scope: ApproveScope

Authority to confer access via an approval, decoupled from the authority to act. Read only by the two conferral paths (compute_delegated_contexts, delegated_any_approver_covers); it never feeds require_admin/has_context_access. Lets an approver be least-privilege (act nowhere, authorize across contexts). #[serde(default)] ⇒ pre-existing rows deserialise as ApproveScope::None.

Implementations§

Source§

impl AclEntry

Source

pub fn new( did: impl Into<String>, role: Role, created_by: impl Into<String>, ) -> Self

Create an entry with the required identity fields. Optional metadata takes sensible defaults: no label, no allowed_contexts, never expires, default ConsumerKind, no capabilities, no device binding, version = 0, and created_at = now. Layer non-defaults on with the with_* builder methods.

This is the single construction entry point — adding a new optional field here defaults it everywhere, so callers don’t churn.

Source

pub fn with_created_at(self, created_at: u64) -> Self

Override created_at (defaults to now). Use when replaying a known timestamp — bootstrap import, tests, migration.

Source

pub fn with_label(self, label: Option<String>) -> Self

Set the optional human-readable label.

Source

pub fn with_contexts(self, allowed_contexts: Vec<String>) -> Self

Set the allowed-contexts (scope) list.

Source

pub fn with_expires_at(self, expires_at: Option<u64>) -> Self

Set the optional expiry (unix seconds). None is permanent.

Source

pub fn with_kind(self, kind: ConsumerKind) -> Self

Set the consumer kind (Companion vs Service).

Source

pub fn with_capabilities(self, capabilities: Vec<Capability>) -> Self

Set the fine-grained capability set.

Source

pub fn with_device(self, device: Option<DeviceBinding>) -> Self

Attach optional Companion/Service device-binding metadata.

Source

pub fn with_step_up_approver(self, approver: Option<String>) -> Self

Set the delegated step-up approver VID (stepUp.approver).

Source

pub fn with_step_up_require(self, require: Option<StepUpMode>) -> Self

Set the per-entry step-up override (stepUp.require).

Source

pub fn with_approve_scope(self, approve_scope: ApproveScope) -> Self

Set the approve-authority scope (what this DID may confer via approval, without any authority to act).

Source

pub fn is_admin(&self) -> bool

Whether this entry is an admin (Role::Admin).

Source

pub fn act_scope(&self) -> ActScope

This entry’s authority to act, decoded from (role, allowed_contexts). Use this rather than reading allowed_contexts directly — see ActScope for why.

Source

pub fn can_act_in(&self, context_id: &str) -> bool

Whether this entry may act in context_id, honouring context ancestry.

Source

pub fn is_super_admin(&self) -> bool

Whether this entry is a super-admin: an admin whose ActScope is unrestricted, mirroring AuthClaims::is_super_admin.

Source

pub fn with_version(self, version: u32) -> Self

Set the optimistic-concurrency version (defaults to 0).

Source

pub fn is_expired(&self, now_unix: u64) -> bool

Returns true if this entry has passed its configured expires_at. Permanent entries (no expires_at) never expire.

Source

pub fn etag(&self) -> String

Strong validator string suitable for the ETag response header and the If-Match precondition on subsequent updates. Combines the DID and the version so a moving version increment can never accidentally validate against the wrong row.

Format: W/"<did_hash>:<version>"W/ because the underlying ACL entry isn’t byte-identical between writes (timestamps, label edits don’t change semantic content but do change bytes); the did_hash is a 64-bit FxHash to keep the header short.

Trait Implementations§

Source§

impl Clone for AclEntry

Source§

fn clone(&self) -> AclEntry

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 AclEntry

Source§

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

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

impl<'de> Deserialize<'de> for AclEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl Serialize for AclEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

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

Source§

fn deserialize_typed<S>( _: &C, deserializer: S, ) -> Result<T, <S as Deserializer<'de>>::Error>
where S: Deserializer<'de>,

Source§

impl<T, U> DeserializeTypedOwned<T> for U
where U: for<'de> DeserializeTyped<'de, T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

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, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ResourceProvider<()> for T

Source§

fn get_resource(&self) -> &()

Returns a reference to the resource of type T.
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> ToOwned for T

Source§

type Owned = T

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>
where T: Sized,

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