Skip to main content

build_rotate_auth_key_payload

Function build_rotate_auth_key_payload 

Source
pub fn build_rotate_auth_key_payload<A: Account, B: Account>(
    current: &A,
    new_account: &B,
    sequence_number: u64,
) -> AptosResult<TransactionPayload>
Expand description

Builds a signed 0x1::account::rotate_authentication_key payload that rotates current’s authentication key to new_account’s key.

Both accounts sign a RotationProofChallenge: current proves it controls the account today, and new_account proves it controls the key being rotated to (preventing an attacker from pointing an account at a key they don’t own).

sequence_number must be the account’s current sequence number.

§Scheme support

This targets the classic rotation path, which supports Ed25519 (scheme 0) and MultiEd25519 (scheme 1) keys for both the source and destination. current and new_account’s signature_scheme / public_key_bytes are forwarded verbatim.

§Errors

Returns an error if either signature cannot be produced, the challenge cannot be BCS-serialized, or the payload cannot be built.