Skip to content

Commit

Permalink
fix(kmd): prompt for password twice when the password is an empty string
Browse files Browse the repository at this point in the history
When using KMD wallet for localnet, it's common that the password is set to an empty string. In this case, the memoised logic failed to detect the existing password.

To fix this:
- the password field is initialised to null
- the memoised logic returns the password if it is not null
  • Loading branch information
PatrickDinh committed Nov 26, 2024
1 parent 9107b30 commit dc0bd94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/use-wallet/src/wallets/kmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class KmdWallet extends BaseWallet {
private options: KmdConstructor
private walletName: string
private walletId: string = ''
private password: string = ''
private password: string | null = null

protected store: Store<State>

Expand Down Expand Up @@ -302,7 +302,7 @@ export class KmdWallet extends BaseWallet {
}

private getPassword(): string {
if (this.password) {
if (this.password !== null) {
return this.password
}
const password = prompt('KMD password') || ''
Expand Down

0 comments on commit dc0bd94

Please sign in to comment.