Commit f262f7c
authored
chore: pin eciesjs to 0.4.17, remove dead ECIES.ts (#26626)
## **Description**
Upgrades eciesjs from `^0.3.15` (resolved 0.3.21, native C addon) to
exact pin `0.4.17` (pure-JS `@noble/*` libraries). This aligns
metamask-mobile with the connect-monorepo and mobile-wallet-protocol
repos, which are already on eciesjs 0.4.x.
**Why:** The version split between mobile (0.3.x) and the dApp side
(0.4.x) risked silent decryption failures in cross-platform relay
communication. The wire format is identical between versions, so this is
a safe upgrade.
**Changes:**
- **package.json**: Pin eciesjs to exact `0.4.17` (no caret). Remove two
`lavamoat.allowScripts` entries for `eciesjs>secp256k1` (0.4.x has no
native dependencies).
- **key-manager.ts**: Update API calls: `.compressed` ->
`.toBytes(true)`, remove unnecessary `Buffer.from()` wrapping on inputs,
add `Buffer.from()` wrapping on return values for type safety.
- **ECIES.ts**: Deleted. This file was dead code - nothing in the
codebase imported it. The V1 SDK Connect path uses the ECIES class
bundled inside the `@metamask/sdk-communication-layer`.
Part of a cross-repo eciesjs version alignment effort (companion PRs in
[connect-monorepo](https://github.com/MetaMask/connect-monorepo) and
[mobile-wallet-protocol](https://github.com/MetaMask/mobile-wallet-protocol)).
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Refs: WAPI-1131
## **Manual testing steps**
No manual steps
## **Screenshots/Recordings**
No UI changes.
https://github.com/user-attachments/assets/a5c73bd9-3d90-4780-84a3-acfbeed0cc85
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Medium risk because it upgrades and rewires ECIES encryption key
handling (a compatibility- and data-path-sensitive area) and adds custom
Metro resolution for cipher subpaths that could affect bundling/runtime
on React Native.
>
> **Overview**
> Pins `eciesjs` to `0.4.17` (bringing in `@noble/*` + `@ecies/ciphers`)
and updates `yarn.lock`/`lavamoat` entries to reflect removal of the
prior native `secp256k1` dependency.
>
> Updates `SDKConnectV2` `KeyManager` to use the new `eciesjs`
key/public-key byte APIs and to pass `Uint8Array` keys directly to
`encrypt`/`decrypt`, with explicit `Buffer.from(...)` wrapping on
outputs for consistent base64/utf8 conversions.
>
> Deletes the unused legacy `ECIES.ts` implementation, and adds Metro
`resolveRequest` overrides to map `@ecies/ciphers` export subpaths
(`@ecies/ciphers/aes`, `@ecies/ciphers/chacha`) to RN-friendly bundle
targets.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8e07b1c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 5afb352 commit f262f7c
5 files changed
Lines changed: 49 additions & 177 deletions
File tree
- app/core
- SDKConnectV2/services
- SDKConnect/ECIES
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
31 | 29 | | |
32 | 30 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
101 | 124 | | |
102 | 125 | | |
103 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
| 366 | + | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
687 | 686 | | |
688 | 687 | | |
689 | 688 | | |
| |||
700 | 699 | | |
701 | 700 | | |
702 | 701 | | |
703 | | - | |
704 | 702 | | |
705 | 703 | | |
706 | 704 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2270 | 2270 | | |
2271 | 2271 | | |
2272 | 2272 | | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
2273 | 2282 | | |
2274 | 2283 | | |
2275 | 2284 | | |
| |||
10447 | 10456 | | |
10448 | 10457 | | |
10449 | 10458 | | |
10450 | | - | |
| 10459 | + | |
10451 | 10460 | | |
10452 | 10461 | | |
10453 | 10462 | | |
| |||
26726 | 26735 | | |
26727 | 26736 | | |
26728 | 26737 | | |
26729 | | - | |
26730 | | - | |
26731 | | - | |
| 26738 | + | |
| 26739 | + | |
| 26740 | + | |
26732 | 26741 | | |
26733 | | - | |
26734 | | - | |
26735 | | - | |
| 26742 | + | |
| 26743 | + | |
| 26744 | + | |
| 26745 | + | |
| 26746 | + | |
26736 | 26747 | | |
26737 | 26748 | | |
26738 | 26749 | | |
| |||
30362 | 30373 | | |
30363 | 30374 | | |
30364 | 30375 | | |
30365 | | - | |
30366 | | - | |
30367 | | - | |
30368 | | - | |
30369 | | - | |
30370 | | - | |
30371 | | - | |
30372 | 30376 | | |
30373 | 30377 | | |
30374 | 30378 | | |
| |||
35590 | 35594 | | |
35591 | 35595 | | |
35592 | 35596 | | |
35593 | | - | |
| 35597 | + | |
35594 | 35598 | | |
35595 | 35599 | | |
35596 | 35600 | | |
| |||
42493 | 42497 | | |
42494 | 42498 | | |
42495 | 42499 | | |
42496 | | - | |
42497 | | - | |
42498 | | - | |
42499 | | - | |
42500 | | - | |
42501 | | - | |
42502 | | - | |
42503 | | - | |
42504 | | - | |
42505 | | - | |
42506 | | - | |
42507 | | - | |
42508 | 42500 | | |
42509 | 42501 | | |
42510 | 42502 | | |
| |||
0 commit comments