@metamask-previews/keyring-controller 21.0.1-preview-6cc620a → 21.0.1-preview-ded32bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1309,6 +1309,7 @@ async function _KeyringController_restoreSerializedKeyrings(serializedKeyrings)
|
|
|
1309
1309
|
* @returns A promise resolving to the deserialized keyrings array.
|
|
1310
1310
|
*/
|
|
1311
1311
|
async function _KeyringController_unlockKeyrings(password, encryptionKey, encryptionSalt) {
|
|
1312
|
+
console.log('Unlock keyrings...');
|
|
1312
1313
|
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withVaultLock).call(this, async ({ releaseLock }) => {
|
|
1313
1314
|
const encryptedVault = this.state.vault;
|
|
1314
1315
|
if (!encryptedVault) {
|
|
@@ -1322,8 +1323,15 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
|
|
|
1322
1323
|
const result = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decryptWithDetail(password, encryptedVault);
|
|
1323
1324
|
vault = result.vault;
|
|
1324
1325
|
__classPrivateFieldSet(this, _KeyringController_password, password, "f");
|
|
1325
|
-
|
|
1326
|
-
|
|
1326
|
+
// This condition is required to not set the state of the keyring
|
|
1327
|
+
// with an encryption key and salt derived from with parameters
|
|
1328
|
+
// that are not the ones set by the encrytor class.
|
|
1329
|
+
if (!__classPrivateFieldGet(this, _KeyringController_encryptor, "f").isVaultUpdated ||
|
|
1330
|
+
!__classPrivateFieldGet(this, _KeyringController_encryptor, "f").isVaultUpdated(encryptedVault)) {
|
|
1331
|
+
console.log('set stored encryption key and salt');
|
|
1332
|
+
updatedState.encryptionKey = result.exportedKeyString;
|
|
1333
|
+
updatedState.encryptionSalt = result.salt;
|
|
1334
|
+
}
|
|
1327
1335
|
}
|
|
1328
1336
|
else {
|
|
1329
1337
|
const parsedEncryptedVault = JSON.parse(encryptedVault);
|