pub fn encode_add_recovery_rotation_capability_script(
    recovery_address: AccountAddress
) -> Script
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 Script::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

NameTypeDescription
to_recover_account&signerThe signer reference of the sending account of this transaction.
recovery_addressaddressThe account address where the to_recover_account’s DiemAccount::KeyRotationCapability will be stored.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::INVALID_STATEDiemAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTEDto_recover_account has already delegated/extracted its DiemAccount::KeyRotationCapability.
Errors::NOT_PUBLISHEDRecoveryAddress::ERECOVERY_ADDRESSrecovery_address does not have a RecoveryAddress resource published under it.
Errors::INVALID_ARGUMENTRecoveryAddress::EINVALID_KEY_ROTATION_DELEGATIONto_recover_account and recovery_address do not belong to the same VASP.
Errors::LIMIT_EXCEEDED RecoveryAddress::EMAX_KEYS_REGISTEREDRecoveryAddress::MAX_REGISTERED_KEYS have already been registered with this recovery_address.
  • Script::create_recovery_address
  • Script::rotate_authentication_key_with_recovery_address