Fix #15050 - MV3: Keep the user logged in when service worker restarts (#15558)

feature/default_network_editable
David Walsh 2 years ago committed by GitHub
parent 42b8971571
commit 266d7d93d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      app/scripts/background.js
  2. 104
      app/scripts/metamask-controller.js
  3. 7
      app/scripts/ui.js
  4. 73
      lavamoat/browserify/beta/policy.json
  5. 101
      lavamoat/browserify/flask/policy.json
  6. 73
      lavamoat/browserify/main/policy.json
  7. 2
      lavamoat/browserify/policy-override.json
  8. 1441
      lavamoat/build-system/policy.json
  9. 2
      package.json
  10. 2
      test/e2e/tests/from-import-ui.spec.js
  11. 6
      test/lib/mock-encryptor.js
  12. 17
      yarn.lock

@ -491,11 +491,6 @@ function setupController(initState, initLangCode, remoteSourcePort) {
controller.setupTrustedCommunication(portStream, remotePort.sender); controller.setupTrustedCommunication(portStream, remotePort.sender);
if (isManifestV3) { if (isManifestV3) {
// Message below if captured by UI code in app/scripts/ui.js which will trigger UI initialisation
// This ensures that UI is initialised only after background is ready
// It fixes the issue of blank screen coming when extension is loaded, the issue is very frequent in MV3
remotePort.postMessage({ name: EXTENSION_MESSAGES.CONNECTION_READY });
// If we get a WORKER_KEEP_ALIVE message, we respond with an ACK // If we get a WORKER_KEEP_ALIVE message, we respond with an ACK
remotePort.onMessage.addListener((message) => { remotePort.onMessage.addListener((message) => {
if (message.name === WORKER_KEEP_ALIVE_MESSAGE) { if (message.name === WORKER_KEEP_ALIVE_MESSAGE) {

@ -55,6 +55,7 @@ import {
} from '@metamask/snaps-controllers'; } from '@metamask/snaps-controllers';
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
import browser from 'webextension-polyfill';
import { import {
ASSET_TYPES, ASSET_TYPES,
TRANSACTION_STATUSES, TRANSACTION_STATUSES,
@ -140,6 +141,7 @@ import seedPhraseVerifier from './lib/seed-phrase-verifier';
import MetaMetricsController from './controllers/metametrics'; import MetaMetricsController from './controllers/metametrics';
import { segment } from './lib/segment'; import { segment } from './lib/segment';
import createMetaRPCHandler from './lib/createMetaRPCHandler'; import createMetaRPCHandler from './lib/createMetaRPCHandler';
import { import {
CaveatMutatorFactories, CaveatMutatorFactories,
getCaveatSpecifications, getCaveatSpecifications,
@ -589,6 +591,7 @@ export default class MetamaskController extends EventEmitter {
keyringTypes: additionalKeyrings, keyringTypes: additionalKeyrings,
initState: initState.KeyringController, initState: initState.KeyringController,
encryptor: opts.encryptor || undefined, encryptor: opts.encryptor || undefined,
cacheEncryptionKey: isManifestV3,
}); });
this.keyringController.memStore.subscribe((state) => this.keyringController.memStore.subscribe((state) =>
this._onKeyringControllerUpdate(state), this._onKeyringControllerUpdate(state),
@ -1118,7 +1121,6 @@ export default class MetamaskController extends EventEmitter {
}, },
controllerMessenger: this.controllerMessenger, controllerMessenger: this.controllerMessenger,
}); });
this.memStore.subscribe(this.sendUpdate.bind(this));
// if this is the first time, clear the state of by calling these methods // if this is the first time, clear the state of by calling these methods
const resetMethods = [ const resetMethods = [
@ -1144,13 +1146,14 @@ export default class MetamaskController extends EventEmitter {
this.resetStates(resetMethods); this.resetStates(resetMethods);
} }
const password = process.env.CONF?.PASSWORD; // Automatic login via config password or loginToken
if ( if (
password &&
!this.isUnlocked() && !this.isUnlocked() &&
this.onboardingController.store.getState().completedOnboarding this.onboardingController.store.getState().completedOnboarding
) { ) {
this.submitPassword(password); this._loginUser();
} else {
this._startUISync();
} }
// Lazily update the store with the current extension environment // Lazily update the store with the current extension environment
@ -2388,6 +2391,68 @@ export default class MetamaskController extends EventEmitter {
return this.keyringController.fullUpdate(); return this.keyringController.fullUpdate();
} }
async _loginUser() {
try {
// Automatic login via config password
const password = process.env.CONF?.PASSWORD;
if (password) {
await this.submitPassword(password);
}
// Automatic login via storage encryption key
else if (isManifestV3) {
await this.submitEncryptionKey();
}
// Updating accounts in this.accountTracker before starting UI syncing ensure that
// state has account balance before it is synced with UI
await this.accountTracker._updateAccounts();
} finally {
this._startUISync();
}
}
_startUISync() {
// Message startUISync is used in MV3 to start syncing state with UI
// Sending this message after login is completed helps to ensure that incomplete state without
// account details are not flushed to UI.
this.emit('startUISync');
this.startUISync = true;
this.memStore.subscribe(this.sendUpdate.bind(this));
}
/**
* Submits a user's encryption key to log the user in via login token
*/
async submitEncryptionKey() {
try {
const { loginToken, loginSalt } = await browser.storage.session.get([
'loginToken',
'loginSalt',
]);
if (loginToken && loginSalt) {
const { vault } = this.keyringController.store.getState();
if (vault.salt !== loginSalt) {
console.warn(
'submitEncryptionKey: Stored salt and vault salt do not match',
);
await this.clearLoginArtifacts();
return;
}
await this.keyringController.submitEncryptionKey(loginToken, loginSalt);
}
} catch (e) {
// If somehow this login token doesn't work properly,
// remove it and the user will get shown back to the unlock screen
await this.clearLoginArtifacts();
throw e;
}
}
async clearLoginArtifacts() {
await browser.storage.session.remove(['loginToken', 'loginSalt']);
}
/** /**
* Submits a user's password to check its validity. * Submits a user's password to check its validity.
* *
@ -3526,6 +3591,23 @@ export default class MetamaskController extends EventEmitter {
}); });
}; };
this.on('update', handleUpdate); this.on('update', handleUpdate);
const startUISync = () => {
if (outStream._writableState.ended) {
return;
}
// send notification to client-side
outStream.write({
jsonrpc: '2.0',
method: 'startUISync',
});
};
if (this.startUISync) {
startUISync();
} else {
this.once('startUISync', startUISync);
}
outStream.on('end', () => { outStream.on('end', () => {
this.activeControllerConnections -= 1; this.activeControllerConnections -= 1;
this.emit( this.emit(
@ -3969,12 +4051,20 @@ export default class MetamaskController extends EventEmitter {
* @private * @private
*/ */
async _onKeyringControllerUpdate(state) { async _onKeyringControllerUpdate(state) {
const { keyrings } = state; const {
keyrings,
encryptionKey: loginToken,
encryptionSalt: loginSalt,
} = state;
const addresses = keyrings.reduce( const addresses = keyrings.reduce(
(acc, { accounts }) => acc.concat(accounts), (acc, { accounts }) => acc.concat(accounts),
[], [],
); );
if (isManifestV3) {
await browser.storage.session.set({ loginToken, loginSalt });
}
if (!addresses.length) { if (!addresses.length) {
return; return;
} }
@ -4366,6 +4456,10 @@ export default class MetamaskController extends EventEmitter {
); );
ledgerKeyring?.destroy?.(); ledgerKeyring?.destroy?.();
if (isManifestV3) {
this.clearLoginArtifacts();
}
return this.keyringController.setLocked(); return this.keyringController.setLocked();
} }

@ -15,7 +15,6 @@ import launchMetaMaskUi, { updateBackgroundConnection } from '../../ui';
import { import {
ENVIRONMENT_TYPE_FULLSCREEN, ENVIRONMENT_TYPE_FULLSCREEN,
ENVIRONMENT_TYPE_POPUP, ENVIRONMENT_TYPE_POPUP,
EXTENSION_MESSAGES,
PLATFORM_FIREFOX, PLATFORM_FIREFOX,
} from '../../shared/constants/app'; } from '../../shared/constants/app';
import { isManifestV3 } from '../../shared/modules/mv3.utils'; import { isManifestV3 } from '../../shared/modules/mv3.utils';
@ -117,11 +116,13 @@ async function start() {
if (isManifestV3) { if (isManifestV3) {
/* /*
* In case of MV3 the issue of blank screen was very frequent, it is caused by UI initialising before background is ready to send state. * In case of MV3 the issue of blank screen was very frequent, it is caused by UI initialising before background is ready to send state.
* Code below ensures that UI is rendered only after CONNECTION_READY message is received thus background is ready. * Code below ensures that UI is rendered only after "CONNECTION_READY" or "startUISync"
* messages are received thus the background is ready, and ensures that streams and
* phishing warning page load only after the "startUISync" message is received.
* In case the UI is already rendered, only update the streams. * In case the UI is already rendered, only update the streams.
*/ */
const messageListener = async (message) => { const messageListener = async (message) => {
if (message?.name === EXTENSION_MESSAGES.CONNECTION_READY) { if (message?.data?.method === 'startUISync') {
if (isUIInitialised) { if (isUIInitialised) {
// Currently when service worker is revived we create new streams // Currently when service worker is revived we create new streams
// in later version we might try to improve it by reviving same streams. // in later version we might try to improve it by reviving same streams.

@ -490,6 +490,7 @@
"@metamask/controllers>abort-controller": true, "@metamask/controllers>abort-controller": true,
"@metamask/controllers>async-mutex": true, "@metamask/controllers>async-mutex": true,
"@metamask/controllers>eth-json-rpc-infura": true, "@metamask/controllers>eth-json-rpc-infura": true,
"@metamask/controllers>eth-keyring-controller": true,
"@metamask/controllers>eth-method-registry": true, "@metamask/controllers>eth-method-registry": true,
"@metamask/controllers>eth-phishing-detect": true, "@metamask/controllers>eth-phishing-detect": true,
"@metamask/controllers>ethereumjs-wallet": true, "@metamask/controllers>ethereumjs-wallet": true,
@ -504,7 +505,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -660,6 +660,37 @@
"safe-event-emitter": true "safe-event-emitter": true
} }
}, },
"@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto.getRandomValues": true,
"crypto.subtle.decrypt": true,
"crypto.subtle.deriveKey": true,
"crypto.subtle.encrypt": true,
"crypto.subtle.importKey": true
},
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"@metamask/controllers>eth-method-registry": { "@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/controllers>eth-method-registry>ethjs": true "@metamask/controllers>eth-method-registry>ethjs": true
@ -1274,6 +1305,7 @@
"@metamask/controllers>web3": true, "@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true, "@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true, "@metamask/metamask-eth-abis": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true,
"@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true,
@ -1282,7 +1314,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -1296,6 +1327,18 @@
"uuid": true "uuid": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true
@ -2465,8 +2508,8 @@
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true, "eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/browser-passworder": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true, "eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>browser-passworder": true,
"eth-keyring-controller>eth-simple-keyring": true, "eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true, "eth-keyring-controller>obs-store": true,
"eth-sig-util": true "eth-sig-util": true
@ -2480,6 +2523,15 @@
"ethereumjs-wallet>randombytes": true "ethereumjs-wallet>randombytes": true
} }
}, },
"eth-keyring-controller>@metamask/browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"browserify>buffer": true
}
},
"eth-keyring-controller>@metamask/eth-hd-keyring": { "eth-keyring-controller>@metamask/eth-hd-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,
@ -2509,21 +2561,6 @@
"msCrypto": true "msCrypto": true
} }
}, },
"eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"eth-keyring-controller>eth-simple-keyring": { "eth-keyring-controller>eth-simple-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,

@ -635,6 +635,7 @@
"@metamask/controllers>abort-controller": true, "@metamask/controllers>abort-controller": true,
"@metamask/controllers>async-mutex": true, "@metamask/controllers>async-mutex": true,
"@metamask/controllers>eth-json-rpc-infura": true, "@metamask/controllers>eth-json-rpc-infura": true,
"@metamask/controllers>eth-keyring-controller": true,
"@metamask/controllers>eth-method-registry": true, "@metamask/controllers>eth-method-registry": true,
"@metamask/controllers>eth-phishing-detect": true, "@metamask/controllers>eth-phishing-detect": true,
"@metamask/controllers>ethereumjs-wallet": true, "@metamask/controllers>ethereumjs-wallet": true,
@ -649,7 +650,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -805,6 +805,37 @@
"safe-event-emitter": true "safe-event-emitter": true
} }
}, },
"@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto.getRandomValues": true,
"crypto.subtle.decrypt": true,
"crypto.subtle.deriveKey": true,
"crypto.subtle.encrypt": true,
"crypto.subtle.importKey": true
},
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"@metamask/controllers>eth-method-registry": { "@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/controllers>eth-method-registry>ethjs": true "@metamask/controllers>eth-method-registry>ethjs": true
@ -1463,6 +1494,7 @@
"@metamask/controllers>web3": true, "@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true, "@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true, "@metamask/metamask-eth-abis": true,
"@metamask/rpc-methods>@metamask/controllers>eth-keyring-controller": true,
"@metamask/rpc-methods>@metamask/controllers>eth-method-registry": true, "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": true,
"@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": true, "@metamask/rpc-methods>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/rpc-methods>nanoid": true, "@metamask/rpc-methods>nanoid": true,
@ -1471,7 +1503,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -1485,6 +1516,18 @@
"uuid": true "uuid": true
} }
}, },
"@metamask/rpc-methods>@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/rpc-methods>@metamask/controllers>eth-method-registry": { "@metamask/rpc-methods>@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": true "@metamask/rpc-methods>@metamask/controllers>eth-method-registry>ethjs": true
@ -1651,6 +1694,7 @@
"@metamask/controllers>web3": true, "@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true, "@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true, "@metamask/metamask-eth-abis": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true,
"@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true,
@ -1659,7 +1703,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -1673,6 +1716,18 @@
"uuid": true "uuid": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true
@ -1848,6 +1903,7 @@
"@metamask/controllers>web3": true, "@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true, "@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true, "@metamask/metamask-eth-abis": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-keyring-controller": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": true, "@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": true,
"@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet": true, "@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/snaps-controllers>nanoid": true, "@metamask/snaps-controllers>nanoid": true,
@ -1856,7 +1912,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -1870,6 +1925,18 @@
"uuid": true "uuid": true
} }
}, },
"@metamask/snaps-controllers>@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": { "@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs": true "@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs": true
@ -3250,8 +3317,8 @@
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true, "eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/browser-passworder": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true, "eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>browser-passworder": true,
"eth-keyring-controller>eth-simple-keyring": true, "eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true, "eth-keyring-controller>obs-store": true,
"eth-sig-util": true "eth-sig-util": true
@ -3265,6 +3332,15 @@
"ethereumjs-wallet>randombytes": true "ethereumjs-wallet>randombytes": true
} }
}, },
"eth-keyring-controller>@metamask/browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"browserify>buffer": true
}
},
"eth-keyring-controller>@metamask/eth-hd-keyring": { "eth-keyring-controller>@metamask/eth-hd-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,
@ -3294,21 +3370,6 @@
"msCrypto": true "msCrypto": true
} }
}, },
"eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"eth-keyring-controller>eth-simple-keyring": { "eth-keyring-controller>eth-simple-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,

@ -490,6 +490,7 @@
"@metamask/controllers>abort-controller": true, "@metamask/controllers>abort-controller": true,
"@metamask/controllers>async-mutex": true, "@metamask/controllers>async-mutex": true,
"@metamask/controllers>eth-json-rpc-infura": true, "@metamask/controllers>eth-json-rpc-infura": true,
"@metamask/controllers>eth-keyring-controller": true,
"@metamask/controllers>eth-method-registry": true, "@metamask/controllers>eth-method-registry": true,
"@metamask/controllers>eth-phishing-detect": true, "@metamask/controllers>eth-phishing-detect": true,
"@metamask/controllers>ethereumjs-wallet": true, "@metamask/controllers>ethereumjs-wallet": true,
@ -504,7 +505,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -660,6 +660,37 @@
"safe-event-emitter": true "safe-event-emitter": true
} }
}, },
"@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto.getRandomValues": true,
"crypto.subtle.decrypt": true,
"crypto.subtle.deriveKey": true,
"crypto.subtle.encrypt": true,
"crypto.subtle.importKey": true
},
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"@metamask/controllers>eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"@metamask/controllers>eth-method-registry": { "@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/controllers>eth-method-registry>ethjs": true "@metamask/controllers>eth-method-registry>ethjs": true
@ -1274,6 +1305,7 @@
"@metamask/controllers>web3": true, "@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true, "@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true, "@metamask/metamask-eth-abis": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": true,
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true, "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": true,
"@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true, "@metamask/smart-transactions-controller>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true, "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": true,
@ -1282,7 +1314,6 @@
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
"eth-keyring-controller": true,
"eth-query": true, "eth-query": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
"eth-sig-util": true, "eth-sig-util": true,
@ -1296,6 +1327,18 @@
"uuid": true "uuid": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controllers>eth-keyring-controller": {
"packages": {
"@metamask/controllers>eth-keyring-controller>browser-passworder": true,
"browserify>buffer": true,
"browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true,
"eth-sig-util": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": { "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry": {
"packages": { "packages": {
"@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true "@metamask/smart-transactions-controller>@metamask/controllers>eth-method-registry>ethjs": true
@ -2465,8 +2508,8 @@
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
"eth-keyring-controller>@metamask/bip39": true, "eth-keyring-controller>@metamask/bip39": true,
"eth-keyring-controller>@metamask/browser-passworder": true,
"eth-keyring-controller>@metamask/eth-hd-keyring": true, "eth-keyring-controller>@metamask/eth-hd-keyring": true,
"eth-keyring-controller>browser-passworder": true,
"eth-keyring-controller>eth-simple-keyring": true, "eth-keyring-controller>eth-simple-keyring": true,
"eth-keyring-controller>obs-store": true, "eth-keyring-controller>obs-store": true,
"eth-sig-util": true "eth-sig-util": true
@ -2480,6 +2523,15 @@
"ethereumjs-wallet>randombytes": true "ethereumjs-wallet>randombytes": true
} }
}, },
"eth-keyring-controller>@metamask/browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"browserify>buffer": true
}
},
"eth-keyring-controller>@metamask/eth-hd-keyring": { "eth-keyring-controller>@metamask/eth-hd-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,
@ -2509,21 +2561,6 @@
"msCrypto": true "msCrypto": true
} }
}, },
"eth-keyring-controller>browser-passworder": {
"globals": {
"btoa": true,
"crypto": true
},
"packages": {
"eth-keyring-controller>browser-passworder>browserify-unibabel": true
}
},
"eth-keyring-controller>browser-passworder>browserify-unibabel": {
"globals": {
"atob": true,
"btoa": true
}
},
"eth-keyring-controller>eth-simple-keyring": { "eth-keyring-controller>eth-simple-keyring": {
"packages": { "packages": {
"browserify>buffer": true, "browserify>buffer": true,

@ -38,7 +38,7 @@
"crypto.getRandomValues": true "crypto.getRandomValues": true
} }
}, },
"eth-keyring-controller>browser-passworder": { "eth-keyring-controller>@metamask/browser-passworder": {
"globals": { "globals": {
"crypto": true "crypto": true
} }

File diff suppressed because it is too large Load Diff

@ -156,7 +156,7 @@
"eth-ens-namehash": "^2.0.8", "eth-ens-namehash": "^2.0.8",
"eth-json-rpc-filters": "^4.2.1", "eth-json-rpc-filters": "^4.2.1",
"eth-json-rpc-middleware": "^9.0.1", "eth-json-rpc-middleware": "^9.0.1",
"eth-keyring-controller": "^7.0.2", "eth-keyring-controller": "^8.0.1",
"eth-lattice-keyring": "^0.12.3", "eth-lattice-keyring": "^0.12.3",
"eth-method-registry": "^2.0.0", "eth-method-registry": "^2.0.0",
"eth-query": "^2.1.2", "eth-query": "^2.1.2",

@ -397,7 +397,7 @@ describe('MetaMask Import UI', function () {
// error should occur // error should occur
await driver.waitForSelector({ await driver.waitForSelector({
css: '.error', css: '.error',
text: "The account you're are trying to import is a duplicate", text: 'The account you are trying to import is a duplicate',
}); });
}, },
); );

@ -12,6 +12,12 @@ const mockEncryptor = {
return Promise.resolve(cacheVal || {}); return Promise.resolve(cacheVal || {});
}, },
encryptWithDetail(_, dataObj) {
cacheVal = dataObj;
return Promise.resolve({ vault: mockHex, exportedKeyString: '' });
},
encryptWithKey(key, dataObj) { encryptWithKey(key, dataObj) {
return this.encrypt(key, dataObj); return this.encrypt(key, dataObj);
}, },

@ -2786,6 +2786,11 @@
resolved "https://registry.yarnpkg.com/@metamask/browser-passworder/-/browser-passworder-3.0.0.tgz#c06744e66a968ffa13f70cc71a7d3b15d86b0ee7" resolved "https://registry.yarnpkg.com/@metamask/browser-passworder/-/browser-passworder-3.0.0.tgz#c06744e66a968ffa13f70cc71a7d3b15d86b0ee7"
integrity sha512-hD10mgvhcDkZX8wnauw8udp1K2MzcbZfrN7Yon9sQ+OqVK9kiQ4VhZAyZNZTy9KJLtfoVD9Y2F6L4gEese7hDA== integrity sha512-hD10mgvhcDkZX8wnauw8udp1K2MzcbZfrN7Yon9sQ+OqVK9kiQ4VhZAyZNZTy9KJLtfoVD9Y2F6L4gEese7hDA==
"@metamask/browser-passworder@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@metamask/browser-passworder/-/browser-passworder-4.0.1.tgz#bb2613bb1886774e18da4107ab94a21042e5e3da"
integrity sha512-mtekzCKph/S/15hRfWFDIUrpvz9mNoIU0CmH0SOlTHpLhalonEsZ+56MbQQUDshXbytzHp1eKr29OHrIx0u9iQ==
"@metamask/contract-metadata@^1.31.0", "@metamask/contract-metadata@^1.35.0": "@metamask/contract-metadata@^1.31.0", "@metamask/contract-metadata@^1.35.0":
version "1.36.0" version "1.36.0"
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.36.0.tgz#8e277190195e9c26733752457d2004d149fd7e0e" resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.36.0.tgz#8e277190195e9c26733752457d2004d149fd7e0e"
@ -11187,6 +11192,18 @@ eth-keyring-controller@^7.0.2:
eth-simple-keyring "^4.2.0" eth-simple-keyring "^4.2.0"
obs-store "^4.0.3" obs-store "^4.0.3"
eth-keyring-controller@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-8.0.1.tgz#02bddda96251aadc739179802ab3dd2f9415d12a"
integrity sha512-6LDnvOIxbA+P6lAAAzde4Kb6hyB70Zs8gPp/enuDrvvFO79LCWGCzP0rre7OQC+agwFsU0gSHJXkRZK8llgPSg==
dependencies:
"@metamask/bip39" "^4.0.0"
"@metamask/browser-passworder" "^4.0.1"
"@metamask/eth-hd-keyring" "^4.0.2"
eth-sig-util "^3.0.1"
eth-simple-keyring "^4.2.0"
obs-store "^4.0.3"
eth-lattice-keyring@^0.12.3: eth-lattice-keyring@^0.12.3:
version "0.12.3" version "0.12.3"
resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.12.3.tgz#32ee3db427d15f1d76f907a36ddc34f4aab205ba" resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.12.3.tgz#32ee3db427d15f1d76f907a36ddc34f4aab205ba"

Loading…
Cancel
Save