[][src]Function transaction_builder::encode_rotate_authentication_key_with_nonce_script

pub fn encode_rotate_authentication_key_with_nonce_script(
    sliding_nonce: u64,
    new_key: Vec<u8>
) -> Script

Summary

Rotates the sender's authentication key to the supplied new authentication key. May be sent by any account that has a sliding nonce resource published under it (usually this is Treasury Compliance or Libra Root accounts).

Technical Description

Rotates the account's LibraAccount::LibraAccount authentication_key field to new_key. new_key must be a valid ed25519 public key, and account must not have previously delegated its LibraAccount::KeyRotationCapability.

Parameters

NameTypeDescription
account&signerSigner reference of the sending account of the transaction.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_keyvector<u8>New ed25519 public key to be used for account.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it's impossible to determine if it's duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
Errors::INVALID_STATELibraAccount::EKEY_ROTATION_CAPABILITY_ALREADY_EXTRACTEDaccount has already delegated/extracted its LibraAccount::KeyRotationCapability.
Errors::INVALID_ARGUMENTLibraAccount::EMALFORMED_AUTHENTICATION_KEYnew_key was an invalid length.

Related Scripts