Commit 0f526b5
committed
wallet: Enforce security boundary in
The ScriptForOutput function previously returned a
`waddrmgr.ManagedPubKeyAddress`. This interface includes a `PrivKey()`
method, which meant that a component designed for managing public
address information (the AddressManager) was leaking an object that
could be used to access private keys. This is a leaky abstraction and
violates the principle of separation of concerns.
This commit refactors ScriptForOutput to return the more general
`waddrmgr.ManagedAddress` interface instead. This interface does not
provide access to private key material.
This change enforces a clean architectural boundary between the
AddressManager (responsible for public data) and the Signer (responsible
for private key operations). The Signer is now the sole component
responsible for retrieving and using private keys, which is its intended
role. This improves the security posture and clarity of the API.ScriptForOutput
1 parent 492b2a2 commit 0f526b5
2 files changed
+31
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
| |||
691 | 689 | | |
692 | 690 | | |
693 | 691 | | |
694 | | - | |
| 692 | + | |
695 | 693 | | |
696 | 694 | | |
697 | | - | |
698 | | - | |
699 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
700 | 705 | | |
701 | | - | |
| 706 | + | |
| 707 | + | |
702 | 708 | | |
703 | 709 | | |
704 | | - | |
| 710 | + | |
705 | 711 | | |
706 | | - | |
707 | | - | |
| 712 | + | |
| 713 | + | |
708 | 714 | | |
709 | 715 | | |
710 | 716 | | |
| |||
715 | 721 | | |
716 | 722 | | |
717 | 723 | | |
718 | | - | |
| 724 | + | |
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
| |||
753 | 759 | | |
754 | 760 | | |
755 | 761 | | |
756 | | - | |
| 762 | + | |
757 | 763 | | |
758 | 764 | | |
759 | 765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
171 | 179 | | |
172 | 180 | | |
173 | 181 | | |
| |||
0 commit comments