Skip to content

Latest commit

 

History

History
274 lines (121 loc) · 9.23 KB

session_key.md

File metadata and controls

274 lines (121 loc) · 9.23 KB

Module 0x3::session_key

Struct SessionScope

The session's scope

struct SessionScope has copy, drop, store

Struct SessionKey

struct SessionKey has copy, drop, store

Resource SessionKeys

struct SessionKeys has key

Constants

The session key already exists

Create session key in this context is not allowed

The session key is invalid

const ErrorSessionKeyIsInvalid: u64 = 3;

The lengths of the parts of the session's scope do not match.

Function new_session_scope

public fun new_session_scope(module_address: address, module_name: string::String, function_name: string::String): session_key::SessionScope

Function is_expired

public(friend) fun is_expired(session_key: &session_key::SessionKey): bool

Function is_expired_session_key

public fun is_expired_session_key(account_address: address, authentication_key: vector<u8>): bool

Function has_session_key

public fun has_session_key(account_address: address): bool

Function exists_session_key

public fun exists_session_key(account_address: address, authentication_key: vector<u8>): bool

Function get_session_key

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>

Function create_session_key

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)

Function create_session_key_entry

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)

Function create_session_key_with_multi_scope_entry

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)

Function in_session_scope

Check the current tx is in the session scope or not

Function active_session_key

public(friend) fun active_session_key(authentication_key: vector<u8>)

Function remove_session_key

public fun remove_session_key(sender: &signer, authentication_key: vector<u8>)

Function remove_session_key_entry

public entry fun remove_session_key_entry(sender: &signer, authentication_key: vector<u8>)

Function get_session_keys_handle

public fun get_session_keys_handle(account_address: address): option::Option<object::ObjectID>