Commit 7ad4e66
authored
feat!: Support specified
This PR **adds a new required constructor argument to
`JsonSnapsRegistry` called `clientConfig`**. By using this constructor
argument we can determine if a Snap version is compatible with the
client version that the user is running. This can be done by comparing
the constructor argument to the optional client metadata in the registry
when resolving the allowlist version.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds a required `clientConfig` to `JsonSnapsRegistry` and uses
registry `clientVersions` to verify and resolve only client-compatible
Snap versions.
>
> - **snaps-controllers**:
> - **Registry compatibility**:
> - Add required constructor arg `clientConfig` to `JsonSnapsRegistry`
and store as private field.
> - When verifying (`SnapsRegistry:get`), require checksum match and
client compatibility using `clientVersions[clientConfig.type]` via
`satisfiesVersionRange`.
> - When resolving (`SnapsRegistry:resolveVersion`), filter allowlisted
versions to those compatible with the provided client before selecting
with `getTargetVersion`.
> - **Tests**:
> - Add compatibility scenarios for verified/unverified outcomes and
version resolution preferring latest compatible.
> - **Dependencies**:
> - Bump `@metamask/snaps-registry` to `^3.3.0` in `snaps-controllers`
and `snaps-utils` (lockfile updated).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9176886. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->clientVersions in the registry (#3737)1 parent c8affd0 commit 7ad4e66
File tree
5 files changed
+153
-14
lines changed- packages
- snaps-controllers
- src/snaps/registry
- snaps-utils
5 files changed
+153
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
87 | 128 | | |
88 | 129 | | |
89 | 130 | | |
| |||
240 | 281 | | |
241 | 282 | | |
242 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
243 | 324 | | |
244 | 325 | | |
245 | 326 | | |
| |||
372 | 453 | | |
373 | 454 | | |
374 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
375 | 488 | | |
376 | 489 | | |
377 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| |||
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| 126 | + | |
| 127 | + | |
120 | 128 | | |
121 | 129 | | |
122 | 130 | | |
| |||
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
| 144 | + | |
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
| |||
167 | 176 | | |
168 | 177 | | |
169 | 178 | | |
| 179 | + | |
170 | 180 | | |
171 | 181 | | |
172 | 182 | | |
| |||
284 | 294 | | |
285 | 295 | | |
286 | 296 | | |
287 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
288 | 302 | | |
289 | 303 | | |
290 | 304 | | |
| |||
338 | 352 | | |
339 | 353 | | |
340 | 354 | | |
341 | | - | |
342 | | - | |
343 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
344 | 368 | | |
345 | 369 | | |
| 370 | + | |
| 371 | + | |
346 | 372 | | |
347 | 373 | | |
348 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4262 | 4262 | | |
4263 | 4263 | | |
4264 | 4264 | | |
4265 | | - | |
| 4265 | + | |
4266 | 4266 | | |
4267 | 4267 | | |
4268 | 4268 | | |
| |||
4413 | 4413 | | |
4414 | 4414 | | |
4415 | 4415 | | |
4416 | | - | |
4417 | | - | |
4418 | | - | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
4419 | 4419 | | |
4420 | | - | |
4421 | | - | |
| 4420 | + | |
| 4421 | + | |
4422 | 4422 | | |
4423 | 4423 | | |
4424 | | - | |
| 4424 | + | |
4425 | 4425 | | |
4426 | 4426 | | |
4427 | 4427 | | |
| |||
4599 | 4599 | | |
4600 | 4600 | | |
4601 | 4601 | | |
4602 | | - | |
| 4602 | + | |
4603 | 4603 | | |
4604 | 4604 | | |
4605 | 4605 | | |
| |||
0 commit comments