Skip to content

Latest commit

 

History

History
232 lines (106 loc) · 8.14 KB

auth_validator.md

File metadata and controls

232 lines (106 loc) · 8.14 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(ctx: &Context, authenticator_payload: vector) fun pre_execute(ctx: &mut Context) fun post_execute(ctx: &mut Context)

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

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

InvalidAuthenticator, include invalid signature

Function error_invalid_account_auth_key

Function error_invalid_authenticator

public fun error_invalid_authenticator(): u64

Function new_auth_validator

public(friend) fun new_auth_validator(id: u64, module_address: address, module_name: ascii::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

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

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