Skip to content

Commit ac42922

Browse files
authored
Merge branch 'main' into jongsun/build/enable-react-compiler-webpack
2 parents d113b91 + 88b054c commit ac42922

File tree

153 files changed

+2901
-1481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+2901
-1481
lines changed

.github/workflows/run-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
RUN_ID: ${{ github.run_id }}
7575
PR_NUMBER: ${{ github.event.pull_request.number || '' }}
7676
TEST_SUITE_NAME: ${{ inputs.test-suite-name }}
77+
IS_SIDEPANEL: true
7778
steps:
7879
- name: Checkout and setup environment
7980
uses: MetaMask/action-checkout-and-setup@v1

app/_locales/en/messages.json

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en_GB/messages.json

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/manifest/v3/_base.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@
8888
"webRequest",
8989
"offscreen",
9090
"identity",
91-
"sidePanel",
92-
"contextMenus"
91+
"sidePanel"
9392
],
9493
"sandbox": {
9594
"pages": ["snaps/index.html"]

app/scripts/background.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
CorruptionHandler,
5656
hasVault,
5757
} from './lib/state-corruption/state-corruption-recovery';
58-
import { initSidePanelContextMenu } from './lib/sidepanel-context-menu';
5958
import {
6059
backedUpStateKeys,
6160
PersistenceManager,
@@ -183,7 +182,6 @@ const PHISHING_WARNING_PAGE_TIMEOUT = ONE_SECOND_IN_MILLISECONDS;
183182

184183
lazyListener.once('runtime', 'onInstalled').then((details) => {
185184
handleOnInstalled(details);
186-
handleSidePanelContextMenu();
187185
});
188186

189187
/**
@@ -1663,15 +1661,6 @@ function onInstall() {
16631661
}
16641662
}
16651663

1666-
/**
1667-
* Handles the onInstalled event for sidepanel context menu creation.
1668-
* This is registered via lazyListener to catch the event at module load time.
1669-
*/
1670-
async function handleSidePanelContextMenu() {
1671-
await isInitialized;
1672-
await initSidePanelContextMenu(controller);
1673-
}
1674-
16751664
/**
16761665
* Trigger actions that should happen only when an update is available
16771666
*/
@@ -1749,18 +1738,6 @@ const initSidePanelBehavior = async () => {
17491738
openPanelOnActionClick: useSidePanelAsDefault,
17501739
});
17511740
}
1752-
1753-
// Setup remote feature flag listener to update sidepanel preferences
1754-
controller?.controllerMessenger?.subscribe(
1755-
'RemoteFeatureFlagController:stateChange',
1756-
(state) => {
1757-
const extensionUxSidepanel =
1758-
state?.remoteFeatureFlags?.extensionUxSidepanel;
1759-
if (extensionUxSidepanel === false) {
1760-
controller?.preferencesController?.setUseSidePanelAsDefault(false);
1761-
}
1762-
},
1763-
);
17641741
} catch (error) {
17651742
console.error('Error setting side panel behavior:', error);
17661743
}

app/scripts/controller-init/keyring-controller-init.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ describe('KeyringControllerInit', () => {
6565
expect(controllerMock).toHaveBeenCalledWith({
6666
messenger: expect.any(Object),
6767
state: undefined,
68-
cacheEncryptionKey: true,
6968
encryptor: expect.any(Object),
7069
keyringBuilders: expect.any(Array),
7170
});

app/scripts/controller-init/keyring-controller-init.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ export const KeyringControllerInit: ControllerInitFunction<
109109
additionalKeyrings.push(snapKeyringBuilder);
110110
///: END:ONLY_INCLUDE_IF
111111

112-
// @ts-expect-error: The types for the encryptor are not correct.
113112
const controller = new KeyringController({
114113
state: persistedState.KeyringController,
115114
messenger: controllerMessenger,
116-
cacheEncryptionKey: true,
117115
keyringBuilders: additionalKeyrings,
118116
encryptor: encryptor || encryptorFactory(600_000),
119117
});

app/scripts/controller-init/seedless-onboarding/seedless-onboarding-controller-init.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ describe('SeedlessOnboardingControllerInit', () => {
7171
decryptWithKey: expect.any(Function),
7272
encrypt: expect.any(Function),
7373
encryptWithDetail: expect.any(Function),
74+
encryptWithKey: expect.any(Function),
75+
isVaultUpdated: expect.any(Function),
7476
importKey: expect.any(Function),
77+
exportKey: expect.any(Function),
78+
generateSalt: expect.any(Function),
79+
keyFromPassword: expect.any(Function),
7580
},
7681
passwordOutdatedCacheTTL: expect.any(Number),
7782
refreshJWTToken: expect.any(Function),

app/scripts/controller-init/seedless-onboarding/seedless-onboarding-controller-init.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
SeedlessOnboardingControllerMessenger,
44
Web3AuthNetwork,
55
} from '@metamask/seedless-onboarding-controller';
6-
import { EncryptionKey, EncryptionResult } from '@metamask/browser-passworder';
6+
import { EncryptionKey } from '@metamask/browser-passworder';
77
import { ControllerInitFunction } from '../types';
88
import { encryptorFactory } from '../../lib/encryptor-factory';
99
import { isDevOrTestBuild } from '../../services/oauth/config';
@@ -24,7 +24,9 @@ export const SeedlessOnboardingControllerInit: ControllerInitFunction<
2424

2525
const network = loadWeb3AuthNetwork();
2626

27-
const controller = new SeedlessOnboardingController({
27+
const controller = new SeedlessOnboardingController<
28+
CryptoKey | EncryptionKey
29+
>({
2830
messenger: controllerMessenger,
2931
state: persistedState.SeedlessOnboardingController,
3032
network,
@@ -41,24 +43,7 @@ export const SeedlessOnboardingControllerInit: ControllerInitFunction<
4143
renewRefreshToken: (...args) =>
4244
initMessenger.call('OAuthService:renewRefreshToken', ...args),
4345

44-
encryptor: {
45-
decrypt: (key, encryptedData) => encryptor.decrypt(key, encryptedData),
46-
decryptWithDetail: (key, encryptedData) =>
47-
encryptor.decryptWithDetail(key, encryptedData),
48-
decryptWithKey(key, encryptedData) {
49-
let payload: EncryptionResult;
50-
if (typeof encryptedData === 'string') {
51-
payload = JSON.parse(encryptedData);
52-
} else {
53-
payload = encryptedData;
54-
}
55-
56-
return encryptor.decryptWithKey(key as EncryptionKey, payload);
57-
},
58-
encrypt: (key, data) => encryptor.encrypt(key, data),
59-
encryptWithDetail: (key, data) => encryptor.encryptWithDetail(key, data),
60-
importKey: (key) => encryptor.importKey(key),
61-
},
46+
encryptor,
6247
});
6348

6449
return {

app/scripts/controller-init/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Duplex } from 'readable-stream';
77
import { SubjectType } from '@metamask/permission-controller';
88
import { PreinstalledSnap } from '@metamask/snaps-controllers';
99
import { Browser } from 'webextension-polyfill';
10-
import { ExportableKeyEncryptor } from '@metamask/keyring-controller';
10+
import { Encryptor } from '@metamask/keyring-controller';
1111
import { KeyringClass } from '@metamask/keyring-utils';
1212
import { QrKeyringScannerBridge } from '@metamask/eth-qr-keyring';
1313
import type { TransactionMetricsRequest } from '../../../shared/types';
@@ -83,7 +83,7 @@ export type ControllerInitRequest<
8383
* An instance of an encryptor to use for encrypting and decrypting
8484
* sensitive data.
8585
*/
86-
encryptor?: ExportableKeyEncryptor;
86+
encryptor: Encryptor;
8787

8888
/**
8989
* The extension browser API.

0 commit comments

Comments
 (0)