Skip to content

Commit

Permalink
reads identity from ledger in 'wallet:multisig:signature:create' (#5717)
Browse files Browse the repository at this point in the history
when a user passes the '--ledger' flag to the
'wallet:multisig:signature:create' command they intend to use a Ledger device
to create a signature share. the identity used _must_ be the identity from
the Ledger device, so read the identity from the device instead of from the
walletDB
  • Loading branch information
hughy authored Feb 5, 2025
1 parent 571b0af commit 5dd7a05
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ironfish-cli/src/commands/wallet/multisig/signature/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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 { multisig } from '@ironfish/rust-nodejs'
import { RpcClient, UnsignedTransaction } from '@ironfish/sdk'
import { UnsignedTransaction } from '@ironfish/sdk'
import { Flags } from '@oclif/core'
import { IronfishCommand } from '../../../../command'
import { RemoteFlags } from '../../../../flags'
Expand Down Expand Up @@ -76,8 +76,6 @@ export class CreateSignatureShareCommand extends IronfishCommand {

if (flags.ledger) {
await this.createSignatureShareWithLedger(
client,
participantName,
unsignedTransaction,
signingPackage.frostSigningPackage().toString('hex'),
)
Expand Down Expand Up @@ -115,15 +113,18 @@ export class CreateSignatureShareCommand extends IronfishCommand {
}

async createSignatureShareWithLedger(
client: RpcClient,
participantName: string,
unsignedTransaction: UnsignedTransaction,
frostSigningPackage: string,
): Promise<void> {
const ledger = new LedgerMultiSigner()

const identityResponse = await client.wallet.multisig.getIdentity({ name: participantName })
const identity = identityResponse.content.identity
const identity = (
await ui.ledger({
ledger,
message: 'Getting Ledger Identity',
action: () => ledger.dkgGetIdentity(0),
})
).toString('hex')

const frostSignatureShare = await ui.ledger({
ledger,
Expand Down

0 comments on commit 5dd7a05

Please sign in to comment.