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', () => {
32773277 } ) ;
32783278 } ) ;
32793279
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+
32803310 describe ( 'verifySeedPhrase' , ( ) => {
32813311 it ( 'should return current seedphrase' , async ( ) => {
32823312 await withController ( async ( { controller } ) => {
You can’t perform that action at this time.
0 commit comments