AuthActions

Struct AuthActions 

Source
pub struct AuthActions<T: Caller> {
    pub caller: T,
}
Expand description

Authenticate actions

transact calls into auth services using auth_interface to authenticate senders of top-level actions and uses of runAs. Any service may become an auth service by implementing auth_interface. Any account may select any service to be its authenticator. Be careful; this allows that service to act on the account’s behalf and that service to authorize other accounts and services to act on the account’s behalf. It can also can lock out that account. See AuthSig (C++) for a canonical example of implementing auth_interface.

This interface can’t authenticate non-top-level actions other than runAs actions. Most services shouldn’t call or implement auth_interface; use get_sender() TODO: link.

Services implement auth_interface by defining actions with identical signatures; there is no trait.

Fields§

§caller: T

Implementations§

Source§

impl<T: Caller> AuthActions<T>

Source

pub fn checkAuthSys( &self, flags: u32, requester: AccountNumber, action: Action, allowedActions: Vec<ServiceMethod>, claims: Vec<Claim>, ) -> T::ReturnsNothing

Authenticate a top-level action or a runAs action

  • flags: One of the Req (request) constants, or’ed with 0 or more of the flag constants
  • requester: "" if this is a top-level action, or the sender of the runAs action. This is often different from action.sender.
  • action: Action to authenticate
  • allowedActions: Argument from runAs
  • claims: Claims in transaction (e.g. public keys). Empty if runAs
Source

pub fn canAuthUserSys(&self, user: AccountNumber) -> T::ReturnsNothing

Verify that a particular user is allowed to use a particular auth service. Allows auth services to use user whitelists.

Called by Accounts.

  • user: The user being checked
Source

pub fn isAuthSys( &self, sender: AccountNumber, authorizers: Vec<AccountNumber>, authSet: Option<Vec<AccountNumber>>, ) -> T::ReturnType<bool>

Check whether a specified set of authorizer accounts are sufficient to authorize sending a transaction from a specified sender.

  • sender: The sender account for the transaction potentially being authorized.
  • authorizers: The set of accounts that have already authorized the execution of the transaction.
  • authSet: The set of accounts that are already being checked for authorization. If the sender is already in this set, then the function should return false.

Returns:

  • true: The authorizers are sufficient to authorize a transaction from the sender.
  • false: The authorizers are not sufficient to authorize a transaction from the sender.
Source

pub fn isRejectSys( &self, sender: AccountNumber, rejecters: Vec<AccountNumber>, authSet: Option<Vec<AccountNumber>>, ) -> T::ReturnType<bool>

Check whether a specified set of rejecter accounts are sufficient to reject (cancel) a transaction from a specified sender.

  • sender: The sender account for the transaction potentially being rejected.
  • rejecters: The set of accounts that have already authorized the rejection of the transaction.
  • authSet: The set of accounts that are already being checked for authorization. If the sender is already in this set, then the function should return false.

Returns:

  • true: The rejecters are sufficient to reject a transaction from the sender.
  • false: The rejecters are not sufficient to reject a transaction from the sender.

Trait Implementations§

Source§

impl<T: Clone + Caller> Clone for AuthActions<T>

Source§

fn clone(&self) -> AuthActions<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Caller> Debug for AuthActions<T>

Source§

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

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

impl<T: Caller> From<T> for AuthActions<T>

Source§

fn from(caller: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Caller> ToActionsSchema for AuthActions<T>

Auto Trait Implementations§

§

impl<T> Freeze for AuthActions<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for AuthActions<T>
where T: RefUnwindSafe,

§

impl<T> Send for AuthActions<T>
where T: Send,

§

impl<T> Sync for AuthActions<T>
where T: Sync,

§

impl<T> Unpin for AuthActions<T>
where T: Unpin,

§

impl<T> UnwindSafe for AuthActions<T>
where T: UnwindSafe,

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<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
where Reference: HasPart<Outer> + ?Sized, Outer: Part<PartType = Field<OuterFieldType>>, Inner: Part, OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,

Source§

unsafe fn part_ptr( ptr: *const <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::Ptr

Given a constant pointer to a target, produce a constant pointer to a part of it. Read more
Source§

unsafe fn part_ptr_mut( ptr: *mut <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::PtrMut

Given a mutable pointer to a target, produce a mutable pointer to a part of it. Read more
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> 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 = 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.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,