본문으로 건너뛰기

Permission

Module: Contracts API

Defines C++ API functions for validating authorization of keys and permissions.

Functions

Name
boolcheck_transaction_authorization(const char trx_data, uint32_t trx_size, const char pubkeys_data, uint32_t pubkeys_size, const char * perms_data, uint32_t perms_size)
boolcheck_permission_authorization(name account, name permission, const char pubkeys_data, uint32_t pubkeys_size, const char perms_data, uint32_t perms_size, microseconds delay)
boolcheck_transaction_authorization(const transaction & trx, const std::set< permission_level > & provided_permissions, const std::set< public_key > & provided_keys =std::set< public_key >())
boolcheck_permission_authorization(name account, name permission, const std::set< public_key > & provided_keys, const std::set< permission_level > & provided_permissions =std::set< permission_level >(), microseconds provided_delay =microseconds{std::numeric_limits< int64_t >::max()})
time_pointget_permission_last_used(name account, name permission)
time_pointget_account_creation_time(name account)

Functions Documentation

function check_transaction_authorization

bool check_transaction_authorization(
const char * trx_data,
uint32_t trx_size,
const char * pubkeys_data,
uint32_t pubkeys_size,
const char * perms_data,
uint32_t perms_size
)

Parameters:

  • trx_data - pointer to the start of the serialized transaction
  • trx_size - size (in bytes) of the serialized transaction
  • pubkeys_data - pointer to the start of the serialized vector of provided public keys
  • pubkeys_size - size (in bytes) of serialized vector of provided public keys (can be 0 if no public keys are to be provided)
  • perms_data - pointer to the start of the serialized vector of provided permissions (empty permission name acts as wildcard)
  • perms_size - size (in bytes) of the serialized vector of provided permissions

Return: 1 if the transaction is authorized, 0 otherwise

Checks if a transaction is authorized by a provided set of keys and permissions

function check_permission_authorization

bool check_permission_authorization(
name account,
name permission,
const char * pubkeys_data,
uint32_t pubkeys_size,
const char * perms_data,
uint32_t perms_size,
microseconds delay
)

Parameters:

  • account - the account owner of the permission
  • permission - the name of the permission to check for authorization
  • pubkeys_data - pointer to the start of the serialized vector of provided public keys
  • pubkeys_size - size (in bytes) of serialized vector of provided public keys (can be 0 if no public keys are to be provided)
  • perms_data - pointer to the start of the serialized vector of provided permissions (empty permission name acts as wildcard)
  • perms_size - size (in bytes) of the serialized vector of provided permissions
  • delay - the provided delay in microseconds (cannot exceed INT64_MAX)

Return: 1 if the permission is authorized, 0 otherwise

Checks if a permission is authorized by a provided delay and a provided set of keys and permissions

function check_transaction_authorization

bool check_transaction_authorization(
const transaction & trx,
const std::set< permission_level > & provided_permissions,
const std::set< public_key > & provided_keys =std::set< public_key >()
)

Parameters:

  • trx - the transaction for which to check authorizations
  • provided_permissions - the set of permissions which have authorized the transaction (empty permission name acts as wildcard)
  • provided_keys - the set of public keys which have authorized the transaction

Return: whether the transaction was authorized by provided keys and permissions

Checks if a transaction is authorized by a provided set of keys and permissions

function check_permission_authorization

bool check_permission_authorization(
name account,
name permission,
const std::set< public_key > & provided_keys,
const std::set< permission_level > & provided_permissions =std::set< permission_level >(),
microseconds provided_delay =microseconds{std::numeric_limits< int64_t >::max()}
)

Parameters:

  • account - the account owner of the permission
  • permission - the permission name to check for authorization
  • provided_keys - the set of public keys which have authorized the transaction
  • provided_permissions - the set of permissions which have authorized the transaction (empty permission name acts as wildcard)
  • provided_delay_us - the provided delay in microseconds (cannot exceed INT64_MAX)

Return: whether the permission was authorized by provided delay, keys, and permissions

Checks if a permission is authorized by a provided delay and a provided set of keys and permissions

function get_permission_last_used

time_point get_permission_last_used(
name account,
name permission
)

Parameters:

  • account - the account owner of the permission
  • permission - the name of the permission

Return: the last used time (in microseconds since Unix epoch) of the permission

Returns the last used time of a permission

function get_account_creation_time

time_point get_account_creation_time(
name account
)

Parameters:

  • account - the account

Return: the creation time (in microseconds since Unix epoch) of the account

Returns the creation time of an account


Updated on 2022-12-05 at 15:38:07 +0000