-
-
Notifications
You must be signed in to change notification settings - Fork 249
Description
There are two main issues we're facing with the controller:
-
Controller state values are stored is inconsistent. Some values are encrypted in the vault, while others are stored inside the encrypted vault and outside the vault too.
-
The #isUnlocked variable within the controller is causing confusion and isn't working correctly. It's meant to synchronize with the KeyringController:lock state. This means if the keyring is locked, the controller should also be locked, and if the keyring is unlocked, the controller should be unlocked too. Currently, this synchronization isn't happening as intended.
This causes confusion as new features and updates are added and creates few bugs too.
Proposed solution
-
State values which are persisted outside the vault should be removed from the vault (e.g.
authPubKey
). The data inside the encrypted vault should be available in the state (as non-persisted data) when the controller is unlocked. -
When the keyring is unlocked and
#isUnlocked
is true, vault should be unlocked(decrypted) and populating the vault data into the controller state. We should be able to read the vault data from the state but not by decrypting the vault multiple times.
Vice versa, when the keyring is locked, the vault data in the state (outside the vault) should be removed and we should not be able to read/decrypt the vault.