Skip to content

Commit 238dda7

Browse files
committed
rename key
1 parent f7ba912 commit 238dda7

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/keyring-controller/src/KeyringController.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,14 @@ export class KeyringController extends BaseController<
908908

909909
assertIsExportableKeyEncryptor(this.#encryptor);
910910

911-
const key = (await this.#encryptor.decrypt(
911+
const decryptedEncryptionKey = (await this.#encryptor.decrypt(
912912
password,
913913
this.state.encryptedEncryptionKey,
914914
)) as string;
915915

916-
const importedKey = await this.#encryptor.importKey(key);
916+
const importedKey = await this.#encryptor.importKey(
917+
decryptedEncryptionKey,
918+
);
917919

918920
await this.#encryptor.decryptWithKey(importedKey, this.state.vault);
919921
} else {
@@ -2363,19 +2365,21 @@ export class KeyringController extends BaseController<
23632365

23642366
if (password) {
23652367
if (encryptedEncryptionKey) {
2366-
const key = (await this.#encryptor.decrypt(
2368+
const decryptedEncryptionKey = (await this.#encryptor.decrypt(
23672369
password,
23682370
encryptedEncryptionKey,
23692371
)) as string;
23702372

2371-
const importedKey = await this.#encryptor.importKey(key);
2373+
const importedKey = await this.#encryptor.importKey(
2374+
decryptedEncryptionKey,
2375+
);
23722376

23732377
vault = await this.#encryptor.decryptWithKey(
23742378
importedKey,
23752379
encryptedVault,
23762380
);
23772381
this.#password = password;
2378-
updatedState.encryptionKey = key;
2382+
updatedState.encryptionKey = decryptedEncryptionKey;
23792383
} else {
23802384
const result = await this.#encryptor.decryptWithDetail(
23812385
password,
@@ -2398,9 +2402,9 @@ export class KeyringController extends BaseController<
23982402
throw new TypeError(KeyringControllerError.WrongPasswordType);
23992403
}
24002404

2401-
const key = await this.#encryptor.importKey(encryptionKey);
2405+
const importedKey = await this.#encryptor.importKey(encryptionKey);
24022406
vault = await this.#encryptor.decryptWithKey(
2403-
key,
2407+
importedKey,
24042408
parsedEncryptedVault,
24052409
);
24062410

@@ -2496,11 +2500,11 @@ export class KeyringController extends BaseController<
24962500
updatedState.encryptionKey = this.#encryptionKey;
24972501

24982502
// Encrypt key and update encrypted key.
2499-
const encryptedKey = await this.#encryptor.encrypt(
2503+
const encryptedEncryptionKey = await this.#encryptor.encrypt(
25002504
this.#password,
25012505
this.#encryptionKey,
25022506
);
2503-
updatedState.encryptedEncryptionKey = encryptedKey;
2507+
updatedState.encryptedEncryptionKey = encryptedEncryptionKey;
25042508

25052509
// Encrypt and update vault.
25062510
const importedKey = await this.#encryptor.importKey(

0 commit comments

Comments
 (0)