Repository navigation
fix: throw explicit error when KeyringController is locked - #5172
Conversation
5834c49 to
5a86062
Compare
b8a66bc to
c60cc5a
Compare
mcmire
left a comment
There was a problem hiding this comment.
@mikesposito What are your thoughts on adding tests for all the cases which we need to assert that the controller is locked? I know there are a lot of methods you're changing, and also there are more changes planned, so not sure if this is unblocking some more work later or if much of this code will disappear later anyway or what.
|
Regardless of the above comment, I reviewed this and it looks like the controller does not need to be in unlocked state to call these methods:
Is that right? |
|
@mcmire the following methods should be callable also while the controller is locked:
This one instead has a missing error in the method itself, but
And I forgot about this one:
|
This is not being done to unblock later work, and I expect these assertions to stay in place. I think it's good to add explicit tests |
Blocked by:
KeyringController#5170Explanation
No specific error is thrown when an operation that requires an unlocked vault is attempted while
KeyringController.state.isUnlockedis 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
KeyringControllermethods to check if the controller is unlocked and to throw an error when it isn't.References
Changelog
@metamask/keyring-controllerChecklist