Skip to content

Commit f1d9bb2

Browse files
chore: bump @metamask/notification-services-controller to ^21.0.0 (MetaMask#24164)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Upgrade `@metamask/notification-services-controller` to `^21.0.0` as no breaking changes were found during verification. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: chore: bump `@metamask/notification-services-controller` to `^21.0.0` ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2187 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- <a href="https://cursor.com/background-agent?bcId=bc-18bd079b-c614-4660-9378-94e3a821d897"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-18bd079b-c614-4660-9378-94e3a821d897"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Aligns `Encryptor` with `@metamask/keyring-controller@^25` (and removes `cacheEncryptionKey`), while bumping notification and profile sync controllers. > > - **Core/Encryptor**: > - Implement `Encryptor` to conform to `@metamask/keyring-controller` `Encryptor<EncryptionKey, KeyDerivationOptions, EncryptionResult>` interface. > - Remove legacy `WithKeyEncryptor` type and related imports from `types.ts`. > - **Engine**: > - Update `keyring-controller-init` to drop `cacheEncryptionKey` option; adjust test to match constructor args. > - **Dependencies**: > - Bump `@metamask/keyring-controller` to `^25.0.0`. > - Bump `@metamask/notification-services-controller` to `^21.0.0` and `@metamask/profile-sync-controller` to `^27.0.0` (lockfile updated). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8d5f489. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 68b310f commit f1d9bb2

6 files changed

Lines changed: 22 additions & 75 deletions

File tree

app/core/Encryptor/Encryptor.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { hasProperty, isPlainObject, Json } from '@metamask/utils';
2+
import type { Encryptor as KeyringControllerEncryptor } from '@metamask/keyring-controller';
23
import {
34
SALT_BYTES_COUNT,
45
ENCRYPTION_LIBRARY,
56
LEGACY_DERIVATION_OPTIONS,
67
} from './constants';
78
import type {
8-
WithKeyEncryptor,
99
EncryptionKey,
1010
EncryptionResult,
1111
KeyDerivationOptions,
@@ -57,7 +57,14 @@ const isEncryptionKey = (key: unknown): key is EncryptionKey =>
5757
* It supports generating a salt, deriving an encryption key from a
5858
* password and salt, and performing the encryption and decryption processes.
5959
*/
60-
class Encryptor implements WithKeyEncryptor<EncryptionKey, Json> {
60+
class Encryptor
61+
implements
62+
KeyringControllerEncryptor<
63+
EncryptionKey,
64+
KeyDerivationOptions,
65+
EncryptionResult
66+
>
67+
{
6168
/**
6269
* The key derivation parameters used for encryption and decryption operations.
6370
* These parameters include the algorithm and its specific parameters, for example, number of iterations for key derivation.
@@ -134,7 +141,6 @@ class Encryptor implements WithKeyEncryptor<EncryptionKey, Json> {
134141
* @param data - The data to encrypt.
135142
* @returns A promise that resolves to an object containing the cipher text and initialization vector (IV).
136143
*/
137-
//@ts-expect-error - TODO: will be implemented at the keyring controller the support for this key type
138144
encryptWithKey = async (
139145
key: EncryptionKey,
140146
data: Json,
@@ -159,7 +165,6 @@ class Encryptor implements WithKeyEncryptor<EncryptionKey, Json> {
159165
* @param payload - The encrypted payload to decrypt.
160166
* @returns The decrypted object.
161167
*/
162-
//@ts-expect-error - TODO: will be implemented at the keyring controller the support for this key type
163168
decryptWithKey = async (
164169
key: EncryptionKey,
165170
payload: EncryptionResult,

app/core/Encryptor/types.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Json } from '@metamask/utils';
22
import type { KeyDerivationOptions } from '@metamask/browser-passworder';
3-
import { ExportableKeyEncryptor } from '@metamask/keyring-controller';
43

54
/** Key derivation function options. */
65
export type { KeyDerivationOptions };
@@ -119,26 +118,3 @@ export interface GenericEncryptor<Data = Json> {
119118
targetDerivationParams?: KeyDerivationOptions,
120119
) => boolean;
121120
}
122-
123-
/**
124-
* An encryptor interface that supports encrypting and decrypting
125-
* serializable data with a password, and exporting and importing keys.
126-
*/
127-
export type WithKeyEncryptor<Key, Data> = ExportableKeyEncryptor & {
128-
/**
129-
* Encrypts the given object with the given encryption key.
130-
*
131-
* @param key - The encryption key to encrypt with.
132-
* @param object - The object to encrypt.
133-
* @returns The encryption result.
134-
*/
135-
encryptWithKey: (key: Key, data: Data) => Promise<EncryptionResult>;
136-
/**
137-
* Decrypts the given encrypted string with the given encryption key.
138-
*
139-
* @param key - The encryption key to decrypt with.
140-
* @param encryptedString - The encrypted string to decrypt.
141-
* @returns The decrypted object.
142-
*/
143-
decryptWithKey: (key: Key, payload: EncryptionResult) => Promise<unknown>;
144-
};

app/core/Engine/controllers/keyring-controller-init.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ describe('keyringControllerInit', () => {
5454
expect(controllerMock).toHaveBeenCalledWith({
5555
messenger: expect.any(Object),
5656
state: undefined,
57-
cacheEncryptionKey: true,
5857
encryptor: expect.any(Encryptor),
5958
keyringBuilders: expect.any(Array),
6059
removeIdentity: expect.any(Function),

app/core/Engine/controllers/keyring-controller-init.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const keyringControllerInit: ControllerInitFunction<
8282
// @ts-expect-error: TODO: Update the type of QRHardwareKeyring to
8383
// `Keyring<Json>`.
8484
keyringBuilders: additionalKeyrings,
85-
cacheEncryptionKey: true,
8685
});
8786

8887
return {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
"@metamask/json-rpc-middleware-stream": "^8.0.7",
235235
"@metamask/key-tree": "patch:@metamask/key-tree@npm%3A10.1.1#~/.yarn/patches/@metamask-key-tree-npm-10.1.1-0bfab435ac.patch",
236236
"@metamask/keyring-api": "^21.3.0",
237-
"@metamask/keyring-controller": "^24.0.0",
237+
"@metamask/keyring-controller": "^25.0.0",
238238
"@metamask/keyring-internal-api": "^9.1.0",
239239
"@metamask/keyring-snap-client": "^8.1.0",
240240
"@metamask/logging-controller": "^7.0.0",
@@ -251,14 +251,14 @@
251251
"@metamask/native-utils": "^0.8.0",
252252
"@metamask/network-controller": "^27.1.0",
253253
"@metamask/network-enablement-controller": "patch:@metamask/network-enablement-controller@npm%3A3.1.0#~/.yarn/patches/@metamask-network-enablement-controller-npm-3.1.0-1c0cfefdc3.patch",
254-
"@metamask/notification-services-controller": "^20.0.0",
254+
"@metamask/notification-services-controller": "^21.0.0",
255255
"@metamask/permission-controller": "^12.1.0",
256256
"@metamask/phishing-controller": "^16.1.0",
257257
"@metamask/post-message-stream": "^10.0.0",
258258
"@metamask/preferences-controller": "^21.0.0",
259259
"@metamask/preinstalled-example-snap": "^0.7.2",
260260
"@metamask/profile-metrics-controller": "^2.0.0",
261-
"@metamask/profile-sync-controller": "^26.0.0",
261+
"@metamask/profile-sync-controller": "^27.0.0",
262262
"@metamask/ramps-controller": "^2.0.0",
263263
"@metamask/react-native-acm": "^1.0.1",
264264
"@metamask/react-native-actionsheet": "2.4.2",

yarn.lock

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7372,15 +7372,6 @@ __metadata:
73727372
languageName: node
73737373
linkType: hard
73747374

7375-
"@metamask/browser-passworder@npm:^4.3.0":
7376-
version: 4.3.0
7377-
resolution: "@metamask/browser-passworder@npm:4.3.0"
7378-
dependencies:
7379-
"@metamask/utils": "npm:^8.2.0"
7380-
checksum: 10/8ba5c50cd6274b0cc0f90a1ee16b960ee150f14c29083f3515f4abe018a28ead32c21f5f4a62a6e27a946b1228adc2ff1f195e71e38782fa39fa8fff116173e6
7381-
languageName: node
7382-
linkType: hard
7383-
73847375
"@metamask/browser-passworder@npm:^5.0.0":
73857376
version: 5.0.0
73867377
resolution: "@metamask/browser-passworder@npm:5.0.0"
@@ -8099,29 +8090,6 @@ __metadata:
80998090
languageName: node
81008091
linkType: hard
81018092

8102-
"@metamask/keyring-controller@npm:^24.0.0":
8103-
version: 24.0.0
8104-
resolution: "@metamask/keyring-controller@npm:24.0.0"
8105-
dependencies:
8106-
"@ethereumjs/util": "npm:^9.1.0"
8107-
"@metamask/base-controller": "npm:^9.0.0"
8108-
"@metamask/browser-passworder": "npm:^4.3.0"
8109-
"@metamask/eth-hd-keyring": "npm:^13.0.0"
8110-
"@metamask/eth-sig-util": "npm:^8.2.0"
8111-
"@metamask/eth-simple-keyring": "npm:^11.0.0"
8112-
"@metamask/keyring-api": "npm:^21.0.0"
8113-
"@metamask/keyring-internal-api": "npm:^9.0.0"
8114-
"@metamask/messenger": "npm:^0.3.0"
8115-
"@metamask/utils": "npm:^11.8.1"
8116-
async-mutex: "npm:^0.5.0"
8117-
ethereumjs-wallet: "npm:^1.0.1"
8118-
immer: "npm:^9.0.6"
8119-
lodash: "npm:^4.17.21"
8120-
ulid: "npm:^2.3.0"
8121-
checksum: 10/35050ec779f364dab6dfa477cc3764b923277074769e2e7a5496ca82000493cf9292a56a048eaa1b361b2ca15369725ae8e2bb6a7f6d91b37ad1d86fab582c23
8122-
languageName: node
8123-
linkType: hard
8124-
81258093
"@metamask/keyring-controller@npm:^25.0.0":
81268094
version: 25.0.0
81278095
resolution: "@metamask/keyring-controller@npm:25.0.0"
@@ -8538,13 +8506,13 @@ __metadata:
85388506
languageName: node
85398507
linkType: hard
85408508

8541-
"@metamask/notification-services-controller@npm:^20.0.0":
8542-
version: 20.0.0
8543-
resolution: "@metamask/notification-services-controller@npm:20.0.0"
8509+
"@metamask/notification-services-controller@npm:^21.0.0":
8510+
version: 21.0.0
8511+
resolution: "@metamask/notification-services-controller@npm:21.0.0"
85448512
dependencies:
85458513
"@contentful/rich-text-html-renderer": "npm:^16.5.2"
85468514
"@metamask/base-controller": "npm:^9.0.0"
8547-
"@metamask/controller-utils": "npm:^11.15.0"
8515+
"@metamask/controller-utils": "npm:^11.16.0"
85488516
"@metamask/messenger": "npm:^0.3.0"
85498517
"@metamask/utils": "npm:^11.8.1"
85508518
bignumber.js: "npm:^9.1.2"
@@ -8553,9 +8521,9 @@ __metadata:
85538521
semver: "npm:^7.6.3"
85548522
uuid: "npm:^8.3.2"
85558523
peerDependencies:
8556-
"@metamask/keyring-controller": ^24.0.0
8557-
"@metamask/profile-sync-controller": ^26.0.0
8558-
checksum: 10/1ec52c32d302a0c6c7fdfa9e2e2bfeb6e8fad36c04206c960afbc98c13b3d4b11b8c6ac7cda5f5b0277f25ad895d6292e0ae2d08a77805a64ab40c623e4bc06b
8524+
"@metamask/keyring-controller": ^25.0.0
8525+
"@metamask/profile-sync-controller": ^27.0.0
8526+
checksum: 10/a36c10cb29bd6a9948f0cc0b8698ff9906aebb4ffc40a6ce1eca8bd9c17b4e181831a18996c0944b505eed1f0abadd58b5af73132dbc36ddb1efcf6cf3d2ab05
85598527
languageName: node
85608528
linkType: hard
85618529

@@ -34213,7 +34181,7 @@ __metadata:
3421334181
"@metamask/json-rpc-middleware-stream": "npm:^8.0.7"
3421434182
"@metamask/key-tree": "patch:@metamask/key-tree@npm%3A10.1.1#~/.yarn/patches/@metamask-key-tree-npm-10.1.1-0bfab435ac.patch"
3421534183
"@metamask/keyring-api": "npm:^21.3.0"
34216-
"@metamask/keyring-controller": "npm:^24.0.0"
34184+
"@metamask/keyring-controller": "npm:^25.0.0"
3421734185
"@metamask/keyring-internal-api": "npm:^9.1.0"
3421834186
"@metamask/keyring-snap-client": "npm:^8.1.0"
3421934187
"@metamask/logging-controller": "npm:^7.0.0"
@@ -34231,15 +34199,15 @@ __metadata:
3423134199
"@metamask/native-utils": "npm:^0.8.0"
3423234200
"@metamask/network-controller": "npm:^27.1.0"
3423334201
"@metamask/network-enablement-controller": "patch:@metamask/network-enablement-controller@npm%3A3.1.0#~/.yarn/patches/@metamask-network-enablement-controller-npm-3.1.0-1c0cfefdc3.patch"
34234-
"@metamask/notification-services-controller": "npm:^20.0.0"
34202+
"@metamask/notification-services-controller": "npm:^21.0.0"
3423534203
"@metamask/object-multiplex": "npm:^1.1.0"
3423634204
"@metamask/permission-controller": "npm:^12.1.0"
3423734205
"@metamask/phishing-controller": "npm:^16.1.0"
3423834206
"@metamask/post-message-stream": "npm:^10.0.0"
3423934207
"@metamask/preferences-controller": "npm:^21.0.0"
3424034208
"@metamask/preinstalled-example-snap": "npm:^0.7.2"
3424134209
"@metamask/profile-metrics-controller": "npm:^2.0.0"
34242-
"@metamask/profile-sync-controller": "npm:^26.0.0"
34210+
"@metamask/profile-sync-controller": "npm:^27.0.0"
3424334211
"@metamask/providers": "npm:^18.3.1"
3424434212
"@metamask/ramps-controller": "npm:^2.0.0"
3424534213
"@metamask/react-native-acm": "npm:^1.0.1"

0 commit comments

Comments
 (0)