@@ -107,11 +107,6 @@ export type KeyringControllerState = {
107
107
encryptedEncryptionKey ?: string ;
108
108
} ;
109
109
110
- export type KeyringControllerPersistentState = Omit <
111
- KeyringControllerState ,
112
- 'isUnlocked' | 'keyrings' | 'encryptionKey' | 'encryptionSalt'
113
- > ;
114
-
115
110
export type KeyringControllerMemState = Omit <
116
111
KeyringControllerState ,
117
112
'vault' | 'encryptionKey' | 'encryptionSalt'
@@ -2296,13 +2291,6 @@ export class KeyringController extends BaseController<
2296
2291
} ;
2297
2292
}
2298
2293
2299
- async #getPersistentState( ) : Promise < KeyringControllerPersistentState > {
2300
- return {
2301
- vault : this . state . vault ,
2302
- encryptedEncryptionKey : this . state . encryptedEncryptionKey ,
2303
- } ;
2304
- }
2305
-
2306
2294
/**
2307
2295
* Restore a serialized keyrings array.
2308
2296
*
@@ -2865,21 +2853,10 @@ export class KeyringController extends BaseController<
2865
2853
callback : MutuallyExclusiveCallback < Result > ,
2866
2854
) : Promise < Result > {
2867
2855
return this . #withRollback( async ( { releaseLock } ) => {
2868
- const oldControllerState = JSON . stringify ( this . #getPersistentState( ) ) ;
2869
2856
const oldState = JSON . stringify ( await this . #getSessionState( ) ) ;
2870
2857
const callbackResult = await callback ( { releaseLock } ) ;
2871
- const newControllerState = JSON . stringify ( this . #getPersistentState( ) ) ;
2872
2858
const newState = JSON . stringify ( await this . #getSessionState( ) ) ;
2873
2859
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
-
2883
2860
// State is committed only if the operation is successful and need to trigger a vault update.
2884
2861
if ( ! isEqual ( oldState , newState ) ) {
2885
2862
await this . #updateVault( ) ;
0 commit comments