# lib.ft4.core.auth · FT4 Rell API · Chromia Docs (concept)

> Types _auth_handler An auth handler defines who can and should call a specific operation. A new auth handler _login_config This struct represents default a

Source: https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/

PACKAGE

# lib.ft4.core.auth

On this page

* [Types](#types)
* [Functions](#functions)
* [Properties](#properties)

## Types

[\_auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_auth_handler/)
:   An auth handler defines who can and should call a specific operation. A new auth handler

[\_login\_config](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_login_config/)
:   This struct represents default auth descriptor configurations that can be used by the client

[auth\_data](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/auth_data/)

[evm\_auth\_args](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/evm_auth_args/)
:   The arguments of the evmauth operation

[module\_args](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/module_args/)
:   configuration used by the auth module, as defined in the chromia.yml file

[rule\_expression](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/rule_expression/)

[rule\_operator](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/rule_operator/)

[rule\_parameters](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/rule_parameters/)

[rule\_variable](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/rule_variable/)
:   Similar to accounts.rulevariable, but it adds two more variables that only make sense

[signature](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/signature/)
:   An EVM signature

## Functions

[\_evm\_message\_hash](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_evm_message_hash/)
:   Given a message, a valid EVM signature will add some information to it prior to hashing it

[\_get\_evm\_signatures](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_get_evm_signatures/)
:   Retrieves the signers and signatures from the evmsignatures operation.

[\_recover\_evm\_address](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_recover_evm_address/)
:   Given the message and signature, extracts the evm address that signed it.

[\_validate\_evm\_address](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_validate_evm_address/)
:   Verifies that the signer of a certain message is the signer of the single-sig auth

[\_validate\_evm\_arguments](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_validate_evm_arguments/)
:   Verifies that the arguments passed to the evmauth operation are valid.

[\_validate\_evm\_signature](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_validate_evm_signature/)
:   Verifies that the signature found in the evmauth operation is valid to authorize the

[\_validate\_ft4\_signature](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_validate_ft4_signature/)
:   Verifies that the signature found in the ftauth operation is valid to authorize the

[\_validate\_multiple\_evm\_addresses](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/_validate_multiple_evm_addresses/)
:   Verifies that the message has been authorized by the multi-sig auth descriptor.

[add\_auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/add_auth_handler/)
:   Utility function that allows easily adding an auth handler.

[add\_login\_config](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/add_login_config/)
:   Utility function to help extend the loginconfig function.

[add\_overridable\_auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/add_overridable_auth_handler/)
:   Like addauthhandler, but the auth handler here defined will not be used if a different

[after\_authenticate](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/after_authenticate/)
:   This function can be extended by users to add custom logic after the authentication of

[args](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/args/)
:   Retrieves the arguments of the operation that led to this function call

[auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/auth_handler/)
:   Extendable function used to define auth handlers. When called it returns a map of all auth

[authenticate](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/authenticate/)
:   calls authenticateandreturncontext and returns just the account

[authenticate\_and\_return\_context](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/authenticate_and_return_context/)
:   Verifies that:

[before\_authenticate](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/before_authenticate/)
:   This function can be extended by users to add custom logic before the authentication of

[block\_height](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/block_height/)

[block\_time](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/block_time/)

[create\_message\_from\_template](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/create_message_from_template/)
:   Creates the message that should be signed on an EVM wallet to approve the given operation.

[equals](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/equals/)

[extract\_account\_and\_auth\_descriptor](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/extract_account_and_auth_descriptor/)
:   Extracts the account ID and auth descriptor ID from the args of the auth operation,

[extract\_account\_id](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/extract_account_id/)
:   Extracts the account ID passed to the auth operation, which is any operation supported by

[fetch\_account\_and\_auth\_descriptor](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/fetch_account_and_auth_descriptor/)
:   Extracts the account and accountauthdescriptor from the args of the auth operation,

[generate\_operation\_auth\_message](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/generate_operation_auth_message/)
:   Creates message from operation name and arguments. It is used when evmauth is used to

[get\_auth\_details\_from\_auth\_operation](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_auth_details_from_auth_operation/)
:   Retrieves the account and auth descriptor ID from the auth operation that precedes the

[get\_auth\_flags](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_auth_flags/)
:   Returns the flags needed to call a certain operation.

[get\_auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_auth_handler/)
:   Finds the auth handler for the provided operation name among all the auth handlers

[get\_auth\_message\_template](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_auth_message_template/)
:   Returns the auth message template that is needed to authorize a certain operation, given its

[get\_evm\_signatures](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_evm_signatures/)
:   Retrieves the signers and signatures from the evmsignatures operation in the

[get\_first\_allowed\_auth\_descriptor](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_first_allowed_auth_descriptor/)
:   Calculates the best auth descriptor to use for the given account when calling the given

[get\_first\_allowed\_auth\_descriptor\_by\_signers](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_first_allowed_auth_descriptor_by_signers/)
:   Like getfirstallowedauthdescriptor, but instead of accepting a list of auth descriptors

[get\_mount\_scope\_auth\_handler](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/get_mount_scope_auth_handler/)
:   Retrieves the auth handler that should be applied to the given operation name, only looking

[greater\_or\_equal](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/greater_or_equal/)

[greater\_than](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/greater_than/)

[is\_auth\_blacklisted\_operation](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/is_auth_blacklisted_operation/)
:   Checks whether auth operations cannot be used with provided operation.

[is\_auth\_op](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/is_auth_op/)
:   Verifies whether the operation passed is an auth operation, that is one of:

[is\_evm\_signatures\_authorized\_operation](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/is_evm_signatures_authorized_operation/)
:   Checks whether evmsignatures operation can be used with provided operation.

[is\_evm\_signatures\_op](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/is_evm_signatures_op/)
:   Verifies whether the operation passed is evmsignatures

[join\_text\_list](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/join_text_list/)
:   Utility function that builds a mount scope given all the parts of it and a number indicating

[less\_or\_equal](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/less_or_equal/)

[less\_than](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/less_than/)

[login\_config](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/login_config/)
:   This function can be extended by users to add custom login configurations.

[login\_rules](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/login_rules/)
:   Converts a list of ruleexpression to a complex rule that can be used inside an auth

[login\_simple\_rule](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/login_simple_rule/)
:   Alias for maprule

[map\_rule](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/map_rule/)
:   Converts a ruleexpression to a gtv config that can be used inside an auth descriptor's

[op\_count](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/op_count/)

[relative\_block\_height](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/relative_block_height/)
:   Same as accounts.blockheight, but using the relative rule variable.

[relative\_block\_time](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/relative_block_time/)
:   Same as accounts.blocktime, but using the relative rule variable.

[require\_evm\_signatures\_can\_be\_used](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/require_evm_signatures_can_be_used/)
:   Ensures that this operation is authorizing an operation which is whitelisted for usage with

[require\_regular\_next\_operation](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/require_regular_next_operation/)
:   Verifies that the next operation is one that will make use of the auth operation that is

[require\_valid\_scope\_name](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/require_valid_scope_name/)
:   Verifies that the scope name is valid, i.e. that it matches this regex:

[try\_fetch\_auth\_descriptor](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/try_fetch_auth_descriptor/)
:   Retrieves an accountauthdescriptor given the account it's associated with and the

[ttl](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/ttl/)
:   Creates a time-to-live rule, which makes the auth descriptor expire after a certain

[valid\_scope\_name](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/valid_scope_name/)
:   Ensures that the scope is valid, also trimming leading and trailing whitespace.

[validate\_signer](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/validate_signer/)
:   Checks if the signer has the correct size

[verify\_signers](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/verify_signers/)
:   Verifies whether provided list of signers have signed the operation/transaction.

[verify\_signers\_with\_message](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/verify_signers_with_message/)
:   Does what verifysigners does, but receives the message as a parameter instead of using

## Properties

[EVM\_AUTH\_OP](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-e-v-m_-a-u-t-h_-o-p/)
:   name of the operation used to authorize through EVM signatures

[FT\_AUTH\_OP](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-f-t_-a-u-t-h_-o-p/)
:   name of the operation used to authorize through FT signatures

[EVM\_ADDRESS\_SIZE](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-e-v-m_-a-d-d-r-e-s-s_-s-i-z-e/)
:   size of a bytearray representing an EVM address, in bytes

[FT\_PUBKEY\_SIZE](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-f-t_-p-u-b-k-e-y_-s-i-z-e/)
:   size of a bytearray representing an FT pubkey, in bytes

[BLOCKCHAIN\_RID\_PLACEHOLDER](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-b-l-o-c-k-c-h-a-i-n_-r-i-d_-p-l-a-c-e-h-o-l-d-e-r/)
:   tag used in auth message construction which will be replaced with blockchain RID

[ACCOUNT\_ID\_PLACEHOLDER](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-a-c-c-o-u-n-t_-i-d_-p-l-a-c-e-h-o-l-d-e-r/)
:   tag used in auth message construction which will be replaced with the authorizing account ID

[AUTH\_DESCRIPTOR\_ID\_PLACEHOLDER](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-a-u-t-h_-d-e-s-c-r-i-p-t-o-r_-i-d_-p-l-a-c-e-h-o-l-d-e-r/)
:   tag used in auth message construction which will be replaced with the authenticating

[NONCE\_PLACEHOLDER](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-n-o-n-c-e_-p-l-a-c-e-h-o-l-d-e-r/)
:   tag used in auth message construction which will be replaced with the unique nonce

[DEFAULT\_LOGIN\_CONFIG\_NAME](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-d-e-f-a-u-l-t_-l-o-g-i-n_-c-o-n-f-i-g_-n-a-m-e/)
:   The name of the default login configuration. This will be used when none is specified

[APP\_SCOPE](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-a-p-p_-s-c-o-p-e/)
:   The constant that defines app level authentication scope.

[OVERRIDE\_PREFIX](https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.core.auth/-o-v-e-r-r-i-d-e_-p-r-e-f-i-x/)
:   This prefix could appear before an auth handler's scope to mark that it can be overridden.

[View this page on docs.chromia.com](https://docs.chromia.com/pages/ft4-rell/-f-t4%20-library/lib.ft4.core.auth/index.html)Generated API reference, mirrored from the live docs
