-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements ledger multisig backup command
adds a CLI command, 'wallet:multisig:ledger:backup', to create an encrypted backup of multisig keys from the ironfish dkg ledger app users can restore the keys to their ledger app if they reinstall the app on their device or overwrite the multisig keys in the app
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
ironfish-cli/src/commands/wallet/multisig/ledger/backup.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
import { IronfishCommand } from '../../../../command' | ||
import { Ledger } from '../../../../utils/ledger' | ||
|
||
export class MultisigLedgerBackup extends IronfishCommand { | ||
static description = `Backup encrypted multisig keys from a Ledger device` | ||
|
||
async start(): Promise<void> { | ||
const ledger = new Ledger(this.logger) | ||
try { | ||
await ledger.connect(true) | ||
} catch (e) { | ||
if (e instanceof Error) { | ||
this.error(e.message) | ||
} else { | ||
throw e | ||
} | ||
} | ||
|
||
const encryptedKeys = await ledger.dkgBackupKeys() | ||
|
||
this.log() | ||
this.log('Encrypted Ledger Multisig Backup:') | ||
this.log(encryptedKeys.toString('hex')) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters