auth module contains types for building custom account contracts that implement authorization logic.
Overview
Custom account contracts implement the__check_auth special function to handle authorization for their addresses. When Address::require_auth is called for a custom account address, the account contract’s __check_auth implementation is invoked to verify the authorization.
Types
Context
Represents the context of a single authorized call performed by an address.Context values corresponding to all calls that need authorization.
ContractContext
Authorization context for a single contract call.require_auth_for_args call with:
contract- The contract address being calledfn_name- The function name being invokedargs- The arguments passed to the function
CreateContractHostFnContext
Authorization context for creating a contract without constructor arguments.CreateContractWithConstructorHostFnContext
Authorization context for creating a contract with constructor arguments.ContractExecutable
Defines the executable used when creating a contract.InvokerContractAuthEntry
A node in the tree of authorizations performed by the current contract as invoker.authorize_as_current_contract to specify authorization for sub-invocations.
SubContractInvocation
Value of a contract node in theInvokerContractAuthEntry tree.
Traits
CustomAccountInterface
Interface for implementing custom account authorization.signature_payload- Hash of the data that should be signedsignatures- Custom signature data provided by the invokerauth_contexts- List of authorization contexts to verify
Ok(()) if authorization succeeds, or an error otherwise.