Commit d1d8459
authored
refactor(keyring-snap-bridge)!: remove
Removing inheritance so we the remaining v1 usage are explicit, since
`SnapKeyring` (v2) was implicitly exposing v1 methods, it made it pretty
difficult to sunset v1 completely.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Breaking public API and behavior split across account creation,
signing, and snap messages in security-sensitive keyring code; incorrect
v1/v2 routing could break snaps or block v2-only accounts.
>
> **Overview**
> **Breaking:** v2 `SnapKeyring` no longer extends `SnapKeyringV1`. V1
behavior is exposed only via an optional `.v1` getter (set when the snap
manifest has no `endowment:keyring` capabilities; `undefined` for
v2-only snaps).
>
> The per-snap v2 class now owns its registry and v2
`KeyringInternalSnapClient`, and on `deserialize` may compose a
`SnapKeyringV1` that shares the same registry. `createAccounts` /
`submitRequest` route to v1 or the v2 client depending on snap version
(including the v1 `{ options }` wrapper vs flat v2 options).
>
> The top-level `SnapKeyring` coordinator routes legacy v1 entry points
(messages, signing, user ops, etc.) through `getKeyringV1For` and throws
clear errors when the target snap is v2-only. `setSelectedAccounts` uses
`keyring.v1?.` so v2 snaps are skipped.
>
> `SnapKeyringV1` gains optional shared `registry`, public `bindSnapId`,
and `createAccounts` for v1 RPC. Changelog and tests document the API
shift and v1/v2 routing.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
693e6f3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->SnapKeyringV1 inheritance (#584)1 parent 97f4634 commit d1d8459
8 files changed
Lines changed: 712 additions & 103 deletions
File tree
- packages/keyring-snap-bridge
- src
- v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3738 | 3738 | | |
3739 | 3739 | | |
3740 | 3740 | | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
| 3746 | + | |
| 3747 | + | |
| 3748 | + | |
| 3749 | + | |
| 3750 | + | |
| 3751 | + | |
| 3752 | + | |
| 3753 | + | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
| 3762 | + | |
| 3763 | + | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
| 3767 | + | |
| 3768 | + | |
| 3769 | + | |
| 3770 | + | |
| 3771 | + | |
| 3772 | + | |
| 3773 | + | |
| 3774 | + | |
| 3775 | + | |
| 3776 | + | |
| 3777 | + | |
| 3778 | + | |
| 3779 | + | |
| 3780 | + | |
| 3781 | + | |
| 3782 | + | |
| 3783 | + | |
| 3784 | + | |
| 3785 | + | |
| 3786 | + | |
| 3787 | + | |
| 3788 | + | |
| 3789 | + | |
| 3790 | + | |
| 3791 | + | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
| 3802 | + | |
| 3803 | + | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
| 3813 | + | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
| 3823 | + | |
| 3824 | + | |
| 3825 | + | |
| 3826 | + | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
3741 | 3880 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
32 | 50 | | |
33 | 51 | | |
34 | 52 | | |
| |||
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
94 | 113 | | |
95 | 114 | | |
96 | 115 | | |
| |||
344 | 363 | | |
345 | 364 | | |
346 | 365 | | |
347 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
348 | 370 | | |
349 | 371 | | |
350 | 372 | | |
| |||
468 | 490 | | |
469 | 491 | | |
470 | 492 | | |
471 | | - | |
| 493 | + | |
472 | 494 | | |
473 | 495 | | |
474 | 496 | | |
| |||
481 | 503 | | |
482 | 504 | | |
483 | 505 | | |
484 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
485 | 510 | | |
486 | 511 | | |
487 | 512 | | |
| |||
535 | 560 | | |
536 | 561 | | |
537 | 562 | | |
538 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
539 | 567 | | |
540 | 568 | | |
541 | 569 | | |
| |||
572 | 600 | | |
573 | 601 | | |
574 | 602 | | |
575 | | - | |
| 603 | + | |
576 | 604 | | |
577 | 605 | | |
578 | 606 | | |
| |||
598 | 626 | | |
599 | 627 | | |
600 | 628 | | |
601 | | - | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
602 | 634 | | |
603 | 635 | | |
604 | 636 | | |
| |||
615 | 647 | | |
616 | 648 | | |
617 | 649 | | |
618 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
619 | 655 | | |
620 | 656 | | |
621 | 657 | | |
| |||
627 | 663 | | |
628 | 664 | | |
629 | 665 | | |
630 | | - | |
| 666 | + | |
631 | 667 | | |
632 | 668 | | |
633 | 669 | | |
| |||
642 | 678 | | |
643 | 679 | | |
644 | 680 | | |
645 | | - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
646 | 685 | | |
647 | 686 | | |
648 | 687 | | |
| |||
659 | 698 | | |
660 | 699 | | |
661 | 700 | | |
662 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
663 | 705 | | |
664 | 706 | | |
665 | 707 | | |
| |||
677 | 719 | | |
678 | 720 | | |
679 | 721 | | |
680 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
681 | 727 | | |
682 | 728 | | |
683 | 729 | | |
| |||
694 | 740 | | |
695 | 741 | | |
696 | 742 | | |
697 | | - | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
698 | 748 | | |
699 | 749 | | |
700 | 750 | | |
| |||
766 | 816 | | |
767 | 817 | | |
768 | 818 | | |
| 819 | + | |
| 820 | + | |
769 | 821 | | |
770 | 822 | | |
771 | | - | |
| 823 | + | |
772 | 824 | | |
773 | 825 | | |
774 | 826 | | |
| |||
0 commit comments