File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
packages/keyring-controller/src Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -3277,6 +3277,36 @@ describe('KeyringController', () => {
3277
3277
} ) ;
3278
3278
} ) ;
3279
3279
3280
+ describe ( 'exportEncryptionKey' , ( ) => {
3281
+ it ( 'should export encryption key and unlock' , async ( ) => {
3282
+ await withController (
3283
+ { cacheEncryptionKey : true } ,
3284
+ async ( { controller } ) => {
3285
+ const encryptionKey = await controller . exportEncryptionKey ( ) ;
3286
+ expect ( encryptionKey ) . toBeDefined ( ) ;
3287
+
3288
+ await controller . setLocked ( ) ;
3289
+
3290
+ await controller . submitEncryptionKey ( encryptionKey ) ;
3291
+
3292
+ expect ( controller . isUnlocked ( ) ) . toBe ( true ) ;
3293
+ } ,
3294
+ ) ;
3295
+ } ) ;
3296
+
3297
+ it ( 'should throw error if controller is locked' , async ( ) => {
3298
+ await withController (
3299
+ { cacheEncryptionKey : true } ,
3300
+ async ( { controller } ) => {
3301
+ await controller . setLocked ( ) ;
3302
+ await expect ( controller . exportEncryptionKey ( ) ) . rejects . toThrow (
3303
+ KeyringControllerError . EncryptionKeyNotSet ,
3304
+ ) ;
3305
+ } ,
3306
+ ) ;
3307
+ } ) ;
3308
+ } ) ;
3309
+
3280
3310
describe ( 'verifySeedPhrase' , ( ) => {
3281
3311
it ( 'should return current seedphrase' , async ( ) => {
3282
3312
await withController ( async ( { controller } ) => {
You can’t perform that action at this time.
0 commit comments