This module implements the native validator.
- Struct
NativeValidator
- Constants
- Function
auth_validator_id
- Function
rotate_authentication_key_entry
- Function
remove_authentication_key_entry
- Function
get_public_key_from_authenticator_payload
- Function
get_signature_from_authenticator_payload
- Function
get_authentication_key_from_authenticator_payload
- Function
public_key_to_address
- Function
public_key_to_authentication_key
- Function
get_authentication_key_with_default
- Function
default_authentication_key
- Function
validate_signature
- Function
validate
use 0x1::option;
use 0x1::signer;
use 0x1::vector;
use 0x2::bcs;
use 0x2::context;
use 0x3::account_authentication;
use 0x3::auth_validator;
use 0x3::ed25519;
use 0x3::hash;
struct NativeValidator has drop, store
const ErrorInvalidPublicKeyLength: u64 = 1;
there defines auth validator id for each blockchain
const NATIVE_VALIDATOR_ID: u64 = 0;
public fun auth_validator_id(): u64
public entry fun rotate_authentication_key_entry(ctx: &mut context::Context, account: &signer, public_key: vector<u8>)
public entry fun remove_authentication_key_entry(ctx: &mut context::Context, account: &signer)
public fun get_public_key_from_authenticator_payload(authenticator_payload: &vector<u8>): vector<u8>
public fun get_signature_from_authenticator_payload(authenticator_payload: &vector<u8>): vector<u8>
Get the authentication key of the given authenticator from authenticator_payload.
public fun get_authentication_key_from_authenticator_payload(authenticator_payload: &vector<u8>): vector<u8>
public fun public_key_to_address(public_key: vector<u8>): address
Get the authentication key of the given public key.
public fun public_key_to_authentication_key(public_key: vector<u8>): vector<u8>
Get the authentication key of the given account, if it not exist, return the account address as authentication key.
public fun get_authentication_key_with_default(ctx: &context::Context, addr: address): vector<u8>
public fun default_authentication_key(addr: address): vector<u8>
Only validate the authenticator's signature.
public fun validate_signature(authenticator_payload: &vector<u8>, tx_hash: &vector<u8>)
public fun validate(ctx: &context::Context, authenticator_payload: vector<u8>)