Skip to content

Latest commit

 

History

History
480 lines (204 loc) · 16.3 KB

auth_validator.md

File metadata and controls

480 lines (204 loc) · 16.3 KB

Module 0x3::auth_validator

This module contains the error code for auth_validator module The auth_validator implementation should contain the following functions public fun validate(authenticator_payload: vector)

Struct AuthValidator

The Authentication Validator

struct AuthValidator has copy, drop, store

Struct TxValidateResult

The Transaction Validate Result this result will be stored in the TxContext

struct TxValidateResult has copy, drop, store

Constants

The function must be executed after the transaction is validated

const ErrorValidateBadChainId: u64 = 1006;

const ErrorValidateCantPayGasDeposit: u64 = 1004;

The function call is beyond the session's scope

The AuthKey in transaction's authenticator do not match with the sender's account auth key

InvalidAuthenticator, include invalid signature

The authenticator's auth validator id is not installed to the sender's account

Validate errors. These are separated out from the other errors in this module since they are mapped separately to major VM statuses, and are important to the semantics of the system.

The session is expired

const ErrorValidateSessionIsExpired: u64 = 1012;

Function error_validate_sequence_number_too_old

Function error_validate_sequence_number_too_new

Function error_validate_account_does_not_exist

Function error_validate_cant_pay_gas_deposit

Function error_validate_transaction_expired

Function error_validate_bad_chain_id

public fun error_validate_bad_chain_id(): u64

Function error_validate_sequence_number_too_big

Function error_validate_max_gas_amount_exceeded

Function error_validate_invalid_account_auth_key

Function error_validate_invalid_authenticator

Function error_validate_not_installed_auth_validator

Function error_validate_session_is_expired

Function error_validate_function_call_beyond_session_scope

Function new_auth_validator

public(friend) fun new_auth_validator(id: u64, module_address: address, module_name: string::String): auth_validator::AuthValidator

Function validator_id

public fun validator_id(validator: &auth_validator::AuthValidator): u64

Function validator_module_address

Function validator_module_name

Function new_tx_validate_result

Function get_validate_result_from_ctx

Get the TxValidateResult from the TxContext, Only can be called after the transaction is validated

Function get_validator_id_from_ctx

Get the auth validator's id from the TxValidateResult in the TxContext

public(friend) fun get_validator_id_from_ctx(): u64

Function get_session_key_from_ctx_option

Get the session key from the TxValidateResult in the TxContext If the TxValidateResult is None or SessionKey is None, return None

Function is_validate_via_session_key

The current tx is validate via the session key or not

public(friend) fun is_validate_via_session_key(): bool

Function get_session_key_from_ctx

Get the session key from the TxValidateResult in the TxContext Only can be called after the transaction is validated

public(friend) fun get_session_key_from_ctx(): vector<u8>

Function get_bitcoin_address_from_ctx