get_first_allowed_auth_descriptor

function get_first_allowed_auth_descriptor(op_name: text, args: gtv, account_id: byte_array, ad_ids: list<byte_array>): byte_array?(source)

Calculates the best auth descriptor to use for the given account when calling the given operation with the given arguments. It assumes that the auth descriptors have all the required auth flags.

If the operation has an auth handler with a resolver function, it will be used to decide which auth descriptor to return. Otherwise, the first auth descriptor on the list will be returned.

If no auth descriptor is returned but ad_ids is not empty, the auth handler resolver function is to blame.

Throws if the auth handler for this operation is not found or its resolver is a function that throws.

Parameters

op_name

the name of the operation to call

args

the arguments for the operation

account_id

the account that will call the operation

ad_ids

the list of auth descriptors that can be used for authenticating

See also

_auth_handler

for more information on auth handlers