Commit 40465f7
authored
feat: add eip1193-compatilble as a supported session property (#8731)
## Explanation
The `@metamask/connect-evm` package is adding support for sending
`sessionProperties: { 'eip1193-compatible': true }` on every
`wallet_createSession` request
([MetaMask/connect-monorepo#285](MetaMask/connect-monorepo#285)).
This lets the wallet distinguish EIP-1193-style connections established
through `connect-evm` from pure Multichain API connections and other
provider types like Solana Wallet Standard.
However, the `chain-agnostic-permission` package validates session
properties against a known set (`KnownSessionProperties` enum), and any
unrecognized property causes the CAIP-25 caveat validator to throw.
Without this change, the new `eip1193-compatible` session property would
be rejected.
This PR adds `Eip1193Compatible = 'eip1193-compatible'` to the
`KnownSessionProperties` enum so the wallet accepts it as a valid
session property.
## References
- Related to
[MetaMask/connect-monorepo#285](MetaMask/connect-monorepo#285)
— the upstream PR that sends this session property from `connect-evm`
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: adds a new allowed CAIP-25 `sessionProperties` key and tags
legacy permission conversions with it, with no changes to scope/account
validation logic beyond accepting this new flag.
>
> **Overview**
> Adds support for the `eip1193-compatible` CAIP-25 session property by
extending `KnownSessionProperties` and related validation/tests so
`wallet_createSession` requests carrying this flag are no longer
rejected.
>
> Updates `getCaip25PermissionFromLegacyPermissions` to always set
`sessionProperties: { 'eip1193-compatible': true }`, and adjusts unit
tests plus the package changelog accordingly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fb7fa99. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c856b75 commit 40465f7
6 files changed
Lines changed: 42 additions & 10 deletions
File tree
- packages/chain-agnostic-permission
- src
- scope
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
Lines changed: 27 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2001 | 2001 | | |
2002 | 2002 | | |
2003 | 2003 | | |
2004 | | - | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
2005 | 2007 | | |
2006 | 2008 | | |
2007 | 2009 | | |
| |||
2038 | 2040 | | |
2039 | 2041 | | |
2040 | 2042 | | |
2041 | | - | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
2042 | 2046 | | |
2043 | 2047 | | |
2044 | 2048 | | |
| |||
2076 | 2080 | | |
2077 | 2081 | | |
2078 | 2082 | | |
2079 | | - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
2080 | 2086 | | |
2081 | 2087 | | |
2082 | 2088 | | |
| |||
2126 | 2132 | | |
2127 | 2133 | | |
2128 | 2134 | | |
2129 | | - | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
2130 | 2138 | | |
2131 | 2139 | | |
2132 | 2140 | | |
| |||
2163 | 2171 | | |
2164 | 2172 | | |
2165 | 2173 | | |
2166 | | - | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
2167 | 2177 | | |
2168 | 2178 | | |
2169 | 2179 | | |
| |||
2201 | 2211 | | |
2202 | 2212 | | |
2203 | 2213 | | |
2204 | | - | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
2205 | 2217 | | |
2206 | 2218 | | |
2207 | 2219 | | |
| |||
2251 | 2263 | | |
2252 | 2264 | | |
2253 | 2265 | | |
2254 | | - | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
2255 | 2269 | | |
2256 | 2270 | | |
2257 | 2271 | | |
| |||
2300 | 2314 | | |
2301 | 2315 | | |
2302 | 2316 | | |
2303 | | - | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
2304 | 2320 | | |
2305 | 2321 | | |
2306 | 2322 | | |
| |||
2349 | 2365 | | |
2350 | 2366 | | |
2351 | 2367 | | |
2352 | | - | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
2353 | 2371 | | |
2354 | 2372 | | |
2355 | 2373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
632 | 633 | | |
633 | 634 | | |
634 | 635 | | |
635 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
636 | 639 | | |
637 | 640 | | |
638 | 641 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
498 | 501 | | |
499 | 502 | | |
500 | 503 | | |
| |||
0 commit comments