Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kmd): handle empty password correctly in getPassword #318

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

PatrickDinh
Copy link
Contributor

fix(kmd): prompt for password twice when the password is an empty string

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

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
Copy link
Collaborator

@drichar drichar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh you're right, with an empty string being falsy it would trigger the prompt again. I like your solution. An unset password is explicitly null and getPassword now checks specifically for that. Thank you for the PR!

@drichar drichar changed the title fix(kmd): prompt for password twice when the password is an empty string fix(kmd): handle empty password correctly in getPassword Nov 28, 2024
@drichar drichar merged commit 4c2f5a8 into TxnLab:main Nov 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants