From 4c2f5a89a8d753f62f9853ffed6ec84325fa79b4 Mon Sep 17 00:00:00 2001 From: Hoang Dinh Date: Thu, 28 Nov 2024 16:57:40 +1000 Subject: [PATCH] fix(kmd): handle empty password correctly in getPassword (#318) 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 --- packages/use-wallet/src/wallets/kmd.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/use-wallet/src/wallets/kmd.ts b/packages/use-wallet/src/wallets/kmd.ts index 6db0b4d3..4f29b43e 100644 --- a/packages/use-wallet/src/wallets/kmd.ts +++ b/packages/use-wallet/src/wallets/kmd.ts @@ -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 @@ -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') || ''