Permissions C API

Methods for testing against transactions, delays, keys and permissions.

Functions

Functions Documentation

function check_transaction_authorization

int32_t 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
)

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

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

Returns:

1 if the transaction is authorized, 0 otherwise

function check_permission_authorization

int32_t check_permission_authorization(
    capi_name account,
    capi_name permission,
    const char * pubkeys_data,
    uint32_t pubkeys_size,
    const char * perms_data,
    uint32_t perms_size,
    uint64_t delay_us
)

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

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_us - the provided delay in microseconds (cannot exceed INT64_MAX)

Returns:

1 if the permission is authorized, 0 otherwise

function get_permission_last_used

int64_t get_permission_last_used(
    capi_name account,
    capi_name permission
)

Returns the last used time of a permission

Parameters:

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

Returns:

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

function get_account_creation_time

int64_t get_account_creation_time(
    capi_name account
)

Returns the creation time of an account

Parameters:

  • account - the account

Returns:

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