Function diem_transaction_builder::stdlib::encode_add_recovery_rotation_capability_script_function
source · pub fn encode_add_recovery_rotation_capability_script_function(
recovery_address: AccountAddress
) -> TransactionPayload
Expand description
Summary
Stores the sending accounts ability to rotate its authentication key with a designated recovery account. Both the sending and recovery accounts need to belong to the same VASP and both be VASP accounts. After this transaction both the sending account and the specified recovery account can rotate the sender account’s authentication key.
Technical Description
Adds the DiemAccount::KeyRotationCapability
for the sending account
(to_recover_account
) to the RecoveryAddress::RecoveryAddress
resource under
recovery_address
. After this transaction has been executed successfully the account at
recovery_address
and the to_recover_account
may rotate the authentication key of
to_recover_account
(the sender of this transaction).
The sending account of this transaction (to_recover_account
) must not have previously given away its unique key
rotation capability, and must be a VASP account. The account at recovery_address
must also be a VASP account belonging to the same VASP as the to_recover_account
.
Additionally the account at recovery_address
must have already initialized itself as
a recovery account address using the AccountAdministrationScripts::create_recovery_address
transaction script.
The sending account’s (to_recover_account
) key rotation capability is
removed in this transaction and stored in the RecoveryAddress::RecoveryAddress
resource stored under the account at recovery_address
.
Parameters
Name | Type | Description |
---|---|---|
to_recover_account | signer | The signer of the sending account of this transaction. |
recovery_address | address | The account address where the to_recover_account ’s DiemAccount::KeyRotationCapability will be stored. |
Common Abort Conditions
Error Category | Error Reason | Description |
---|---|---|
Errors::INVALID_STATE | DiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTED | to_recover_account has already delegated/extracted its DiemAccount::KeyRotationCapability . |
Errors::NOT_PUBLISHED | RecoveryAddress::ERECOVERY_ADDRESS | recovery_address does not have a RecoveryAddress resource published under it. |
Errors::INVALID_ARGUMENT | RecoveryAddress::EINVALID_KEY_ROTATION_DELEGATION | to_recover_account and recovery_address do not belong to the same VASP. |
Errors::LIMIT_EXCEEDED | RecoveryAddress::EMAX_KEYS_REGISTERED | RecoveryAddress::MAX_REGISTERED_KEYS have already been registered with this recovery_address . |
Related Scripts
AccountAdministrationScripts::create_recovery_address
AccountAdministrationScripts::rotate_authentication_key_with_recovery_address