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: throw explicit error when KeyringController is locked #5172

Draft
wants to merge 5 commits into
base: mikesposito/lint-fix
Choose a base branch
from

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Jan 17, 2025

Blocked by:

Explanation

No specific error is thrown when an operation that requires an unlocked vault is attempted while KeyringController.state.isUnlocked is false. This doesn't make the operations possible, but it doesn't give a clear error message either.

This PR adds an assertion on almost all KeyringController methods to check if the controller is unlocked and to throw an error when it isn't.

References

Changelog

@metamask/keyring-controller

  • CHANGED: A specific error message is thrown when any operation is attempted while the controller is locked

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@mikesposito mikesposito requested a review from a team as a code owner January 17, 2025 12:12
@mikesposito mikesposito marked this pull request as draft January 17, 2025 12:29
@mikesposito mikesposito force-pushed the fix/assert-controller-unlocked branch from 5834c49 to 5a86062 Compare January 17, 2025 13:40
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.

1 participant