Skip to main content

DelegationApi

Struct DelegationApi 

Source
pub struct DelegationApi;
Expand description

DelegationApi

Requires auth.delegated_tokens.enabled = true in config.

Implementations§

Source§

impl DelegationApi

Source

pub async fn admin( cmd: DelegationAdminCommand, ) -> Result<DelegationAdminResponse, Error>

Execute explicit root-controlled delegation repair/prewarm operations.

Source§

impl DelegationApi

Source§

impl DelegationApi

Source

pub fn set_delegated_session_subject( delegated_subject: Principal, bootstrap_token: DelegatedToken, requested_ttl_secs: Option<u64>, ) -> Result<(), Error>

Persist a temporary delegated session subject for the caller wallet.

Source

pub fn clear_delegated_session()

Remove the caller’s delegated session subject.

Source

pub fn delegated_session_subject() -> Option<Principal>

Read the caller’s active delegated session subject, if configured.

Source

pub fn prune_expired_delegated_sessions() -> usize

Prune all currently expired delegated sessions.

Source§

impl DelegationApi

Source

pub fn verify_delegation_proof( proof: &DelegationProof, authority_pid: Principal, ) -> Result<(), Error>

Full delegation proof verification (structure + signature).

Purely local verification; does not read certified data or require a query context.

Source

pub async fn issue_token( claims: DelegatedTokenClaims, ) -> Result<DelegatedToken, Error>

Issue a delegated token using a reusable local proof when possible.

If the proof is missing or no longer valid for the requested claims, this performs canonical shard-initiated setup and retries with the refreshed proof.

Source

pub fn verify_token( token: &DelegatedToken, authority_pid: Principal, now_secs: u64, ) -> Result<(), Error>

Full delegated token verification (structure + signature).

Purely local verification; does not read certified data or require a query context.

Source

pub fn verify_token_verified( token: &DelegatedToken, authority_pid: Principal, now_secs: u64, ) -> Result<(DelegatedTokenClaims, DelegationCert), Error>

Verify a delegated token and return verified contents.

This is intended for application-layer session construction. It performs full verification and returns verified claims and cert.

Source

pub async fn request_delegation( request: DelegationRequest, ) -> Result<DelegationProvisionResponse, Error>

Canonical shard-initiated delegation request (user_shard -> root).

Caller must match shard_pid and be registered to the subnet.

Source

pub async fn request_role_attestation( request: RoleAttestationRequest, ) -> Result<SignedRoleAttestation, Error>

Source

pub async fn attestation_key_set() -> Result<AttestationKeySet, Error>

Source

pub fn replace_attestation_key_set(key_set: AttestationKeySet)

Source

pub async fn verify_role_attestation( attestation: &SignedRoleAttestation, min_accepted_epoch: u64, ) -> Result<(), Error>

Source§

impl DelegationApi

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> 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, 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> 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.