Skip to content

Commit

Permalink
reads identity from ledger in 'wallet:multisig:commitment:create' (#5716
Browse files Browse the repository at this point in the history
)

when a user passes the '--ledger' flag to the
'wallet:multisig:commitment:create' command they intend to use a Ledger device
to create a signing commitment. 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 acd4c8b commit 571b0af
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions ironfish-cli/src/commands/wallet/multisig/commitment/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 @@ -95,12 +95,7 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
await ui.confirmOrQuit('Confirm signing commitment creation', flags.confirm)

if (flags.ledger) {
await this.createSigningCommitmentWithLedger(
client,
participantName,
unsignedTransaction,
identities,
)
await this.createSigningCommitmentWithLedger(unsignedTransaction, identities)
return
}

Expand All @@ -119,15 +114,18 @@ export class CreateSigningCommitmentCommand extends IronfishCommand {
}

async createSigningCommitmentWithLedger(
client: RpcClient,
participantName: string,
unsignedTransaction: UnsignedTransaction,
signers: 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 rawCommitments = await ui.ledger({
ledger,
Expand Down

0 comments on commit 571b0af

Please sign in to comment.