@@ -107,11 +107,6 @@ export type KeyringControllerState = {
107107 encryptedEncryptionKey ?: string ;
108108} ;
109109
110- export type KeyringControllerPersistentState = Omit <
111- KeyringControllerState ,
112- 'isUnlocked' | 'keyrings' | 'encryptionKey' | 'encryptionSalt'
113- > ;
114-
115110export type KeyringControllerMemState = Omit <
116111 KeyringControllerState ,
117112 'vault' | 'encryptionKey' | 'encryptionSalt'
@@ -2296,13 +2291,6 @@ export class KeyringController extends BaseController<
22962291 } ;
22972292 }
22982293
2299- async #getPersistentState( ) : Promise < KeyringControllerPersistentState > {
2300- return {
2301- vault : this . state . vault ,
2302- encryptedEncryptionKey : this . state . encryptedEncryptionKey ,
2303- } ;
2304- }
2305-
23062294 /**
23072295 * Restore a serialized keyrings array.
23082296 *
@@ -2865,21 +2853,10 @@ export class KeyringController extends BaseController<
28652853 callback : MutuallyExclusiveCallback < Result > ,
28662854 ) : Promise < Result > {
28672855 return this . #withRollback( async ( { releaseLock } ) => {
2868- const oldControllerState = JSON . stringify ( this . #getPersistentState( ) ) ;
28692856 const oldState = JSON . stringify ( await this . #getSessionState( ) ) ;
28702857 const callbackResult = await callback ( { releaseLock } ) ;
2871- const newControllerState = JSON . stringify ( this . #getPersistentState( ) ) ;
28722858 const newState = JSON . stringify ( await this . #getSessionState( ) ) ;
28732859
2874- // We should never alter the controller state from within the callback.
2875- if ( ! isEqual ( oldControllerState , newControllerState ) ) {
2876- // Attempt to revert the update.
2877- this . update ( ( ) => JSON . parse ( oldControllerState ) ) ;
2878- throw new Error (
2879- KeyringControllerError . StateChangedWhileExecutingCallback ,
2880- ) ;
2881- }
2882-
28832860 // State is committed only if the operation is successful and need to trigger a vault update.
28842861 if ( ! isEqual ( oldState , newState ) ) {
28852862 await this . #updateVault( ) ;
0 commit comments