[CLI][Ledger] Incorporate key rotation support for Ledger #13515
Labels
enhancement
New feature or request
stale-exempt
Prevents issues from being automatically marked and closed as stale
Overview
It should now be possible to rotate an account's authentication key to be secured by a Ledger hardware wallet. Implementation steps below, detailed background at bottom.
Implementation roadmap
In Ledger library
Create a function based onNot needed as of 0.6.9 C APIs for Ledgeraptos_ledger::sign_message
, for exampleaptos_ledger::sign_bytes
, which allows for signing of an arbitrary bytes vector, per Version v0.6.9: SDK upgrade, Ledger Stax UI, Improve Blind Signing behavior LedgerHQ/app-aptos#13 (comment).In CLI
new_derivation_path
toRotateKey
to support rotation to a Ledger, usingaptos_ledger::get_public_key
as needed for the CLI profile. (Added in [CLI][Framework][Ledger] Add Ledger key rotation and more profile management to CLI, fix/extend associated Framework code #11151)aptos_ledger::sign_bytes
or similar from above to sign aRotationProofChallenge
as needed. (Added in [CLI][Framework][Ledger] Add Ledger key rotation and more profile management to CLI, fix/extend associated Framework code #11151)Add(Addressed with new CLI profile management functions in [CLI][Framework][Ledger] Add Ledger key rotation and more profile management to CLI, fix/extend associated Framework code #11151)rename_stale_profile
option toRotateKey
with accompanying interactive prompt, so that user can optionally rename the CLI profile that is rendered stale after a successful rotation. (e.g. user rotatesmy-nft-hot-wallet
from a private key profile to a Ledger profile, somy-nft-hot-wallet
gets renamed tomy-nft-hot-wallet-before-rotation
, and the new profile gets namedmy-nft-hardware-wallet
). This is useful for record-keeping, and a stale profile is especially useful to have on hand when a user needs to temporarily rotate a Ledger wallet back to a hot wallet in order to publish a package that can not be signed by a Ledger due to its memory constraints.Update(Addressed with new CLI profile management functions in [CLI][Framework][Ledger] Add Ledger key rotation and more profile management to CLI, fix/extend associated Framework code #11151)RotateSummary
.message
to print out new name of the renamed stale profile fromRotateKey
.rename_stale_profile
input.Background
In #11151, I attempted to update the CLI to support key rotation to a Ledger wallet. However, this was blocked by the Ledger's inability to sign an arbitrary message, as required for the
RotationProofChallenge
. @hardsetting began collaborating with @vldmkr on adding blind signing functionality for the Ledger and I put Ledger key rotation efforts on hold.Recently, during an in-person discussion with @davidiw, @gedigi, @hariria, and @xbtmatt, I learned about the introduction of
rotate_authentication_key_call
, so I submitted aptos-labs/developer-docs#367 to demonstrate how the new function could enable key rotation to and from a Ledger hardware wallet without getting blocked by theRotationProofChallenge
signing process.During PR review, @gregnazario left comment aptos-labs/developer-docs#367 (comment), which I interpreted as a suggestion to update the CLI to use
rotate_authentication_key_call
instead of the existingrotate_authentication_key
.However, since the existing CLI implementation relies on
rotate_authentication_key
, CLI rotations result in updates to theOriginatingAddress
table, which would not be the case forrotate_authentication_key_call
if it were to be incorporated in the CLI unless some kind of reconciliation function were added to the framework. (For example a function likeaccount::ensure_originating_address_for_account
, as proposed in #13517).Even if a followup reconciliation function were to be added, however, it would still complicate the process due to the two-transaction process required when rotating via
rotate_authentication_key_call
.While doing this writeup, I stumbled upon LedgerHQ/app-aptos#13 (comment), which indicates to me that arbitrary message signing is probably now available in the Ledger app API, such that a Ledger can indeed sign a
RotationProofChallenge
.The text was updated successfully, but these errors were encountered: