- Struct
SessionScope
- Struct
SessionKey
- Resource
SessionKeys
- Constants
- Function
new_session_scope
- Function
is_expired
- Function
is_expired_session_key
- Function
has_session_key
- Function
exists_session_key
- Function
get_session_key
- Function
create_session_key
- Function
create_session_key_entry
- Function
create_session_key_with_multi_scope_entry
- Function
in_session_scope
- Function
active_session_key
- Function
remove_session_key
- Function
remove_session_key_entry
- Function
get_session_keys_handle
use 0x1::option;
use 0x1::signer;
use 0x1::string;
use 0x1::vector;
use 0x2::account;
use 0x2::object;
use 0x2::table;
use 0x2::timestamp;
use 0x2::tx_context;
use 0x2::tx_meta;
use 0x3::auth_validator;
The session's scope
struct SessionScope has copy, drop, store
struct SessionKey has copy, drop, store
struct SessionKeys has key
The max inactive interval is invalid
const ErrorInvalidMaxInactiveInterval: u64 = 5;
The session key already exists
const ErrorSessionKeyAlreadyExists: u64 = 2;
Create session key in this context is not allowed
const ErrorSessionKeyCreatePermissionDenied: u64 = 1;
The session key is invalid
const ErrorSessionKeyIsInvalid: u64 = 3;
The lengths of the parts of the session's scope do not match.
const ErrorSessionScopePartLengthNotMatch: u64 = 4;
const MAX_INACTIVE_INTERVAL: u64 = 2592000;
public fun new_session_scope(module_address: address, module_name: string::String, function_name: string::String): session_key::SessionScope
public(friend) fun is_expired(session_key: &session_key::SessionKey): bool
public fun is_expired_session_key(account_address: address, authentication_key: vector<u8>): bool
public fun has_session_key(account_address: address): bool
public fun exists_session_key(account_address: address, authentication_key: vector<u8>): bool
Get the session key of the account_address by the authentication key
public fun get_session_key(account_address: address, authentication_key: vector<u8>): option::Option<session_key::SessionKey>
public fun create_session_key(sender: &signer, app_name: string::String, app_url: string::String, authentication_key: vector<u8>, scopes: vector<session_key::SessionScope>, max_inactive_interval: u64)
public entry fun create_session_key_entry(sender: &signer, app_name: string::String, app_url: string::String, authentication_key: vector<u8>, scope_module_address: address, scope_module_name: string::String, scope_function_name: string::String, max_inactive_interval: u64)
public entry fun create_session_key_with_multi_scope_entry(sender: &signer, app_name: string::String, app_url: string::String, authentication_key: vector<u8>, scope_module_addresses: vector<address>, scope_module_names: vector<string::String>, scope_function_names: vector<string::String>, max_inactive_interval: u64)
Check the current tx is in the session scope or not
public(friend) fun in_session_scope(session_key: &session_key::SessionKey): bool
public(friend) fun active_session_key(authentication_key: vector<u8>)
public fun remove_session_key(sender: &signer, authentication_key: vector<u8>)
public entry fun remove_session_key_entry(sender: &signer, authentication_key: vector<u8>)
public fun get_session_keys_handle(account_address: address): option::Option<object::ObjectID>