@bsv/sdk 1.1.12 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/primitives/Point.js +28 -8
- package/dist/cjs/src/primitives/Point.js.map +1 -1
- package/dist/cjs/src/primitives/Polynomial.js +81 -0
- package/dist/cjs/src/primitives/Polynomial.js.map +1 -0
- package/dist/cjs/src/primitives/PrivateKey.js +165 -0
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -1
- package/dist/cjs/src/primitives/PublicKey.js +16 -2
- package/dist/cjs/src/primitives/PublicKey.js.map +1 -1
- package/dist/cjs/src/primitives/index.js +5 -1
- package/dist/cjs/src/primitives/index.js.map +1 -1
- package/dist/cjs/src/primitives/utils.js +1 -1
- package/dist/cjs/src/script/templates/P2PKH.js.map +1 -1
- package/dist/cjs/src/script/templates/RPuzzle.js.map +1 -1
- package/dist/cjs/src/transaction/Transaction.js +9 -4
- package/dist/cjs/src/transaction/Transaction.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/ARC.js +4 -4
- package/dist/cjs/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/WhatsOnChainBroadcaster.js +3 -3
- package/dist/cjs/src/transaction/broadcasters/WhatsOnChainBroadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/chaintrackers/DefaultChainTracker.js.map +1 -1
- package/dist/cjs/src/transaction/chaintrackers/WhatsOnChain.js +2 -2
- package/dist/cjs/src/transaction/chaintrackers/WhatsOnChain.js.map +1 -1
- package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -1
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js +2 -2
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/FetchHttpClient.js +2 -2
- package/dist/cjs/src/transaction/http/FetchHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js +2 -2
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/primitives/Point.js +28 -8
- package/dist/esm/src/primitives/Point.js.map +1 -1
- package/dist/esm/src/primitives/Polynomial.js +77 -0
- package/dist/esm/src/primitives/Polynomial.js.map +1 -0
- package/dist/esm/src/primitives/PrivateKey.js +143 -0
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -1
- package/dist/esm/src/primitives/PublicKey.js +16 -2
- package/dist/esm/src/primitives/PublicKey.js.map +1 -1
- package/dist/esm/src/primitives/index.js +2 -1
- package/dist/esm/src/primitives/index.js.map +1 -1
- package/dist/esm/src/primitives/utils.js +1 -1
- package/dist/esm/src/script/templates/P2PKH.js.map +1 -1
- package/dist/esm/src/script/templates/RPuzzle.js.map +1 -1
- package/dist/esm/src/transaction/Transaction.js +9 -4
- package/dist/esm/src/transaction/Transaction.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/ARC.js +7 -7
- package/dist/esm/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/WhatsOnChainBroadcaster.js +4 -4
- package/dist/esm/src/transaction/broadcasters/WhatsOnChainBroadcaster.js.map +1 -1
- package/dist/esm/src/transaction/chaintrackers/DefaultChainTracker.js +1 -1
- package/dist/esm/src/transaction/chaintrackers/DefaultChainTracker.js.map +1 -1
- package/dist/esm/src/transaction/chaintrackers/WhatsOnChain.js +3 -3
- package/dist/esm/src/transaction/chaintrackers/WhatsOnChain.js.map +1 -1
- package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -1
- package/dist/esm/src/transaction/http/DefaultHttpClient.js +2 -2
- package/dist/esm/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/FetchHttpClient.js +2 -2
- package/dist/esm/src/transaction/http/FetchHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/NodejsHttpClient.js +2 -2
- package/dist/esm/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/primitives/Point.d.ts +19 -1
- package/dist/types/src/primitives/Point.d.ts.map +1 -1
- package/dist/types/src/primitives/Polynomial.d.ts +32 -0
- package/dist/types/src/primitives/Polynomial.d.ts.map +1 -0
- package/dist/types/src/primitives/PrivateKey.d.ts +72 -0
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -1
- package/dist/types/src/primitives/PublicKey.d.ts +12 -1
- package/dist/types/src/primitives/PublicKey.d.ts.map +1 -1
- package/dist/types/src/primitives/index.d.ts +2 -1
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/src/primitives/utils.d.ts +1 -1
- package/dist/types/src/script/templates/P2PKH.d.ts.map +1 -1
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/ARC.d.ts +1 -1
- package/dist/types/src/transaction/broadcasters/ARC.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/DefaultBroadcaster.d.ts +1 -1
- package/dist/types/src/transaction/broadcasters/DefaultBroadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/WhatsOnChainBroadcaster.d.ts +1 -1
- package/dist/types/src/transaction/broadcasters/WhatsOnChainBroadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/chaintrackers/DefaultChainTracker.d.ts +1 -1
- package/dist/types/src/transaction/chaintrackers/DefaultChainTracker.d.ts.map +1 -1
- package/dist/types/src/transaction/chaintrackers/WhatsOnChain.d.ts +2 -2
- package/dist/types/src/transaction/chaintrackers/WhatsOnChain.d.ts.map +1 -1
- package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts.map +1 -1
- package/dist/types/src/transaction/http/DefaultHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/FetchHttpClient.d.ts +7 -9
- package/dist/types/src/transaction/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/HttpClient.d.ts +5 -5
- package/dist/types/src/transaction/http/HttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts +5 -6
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/primitives.md +231 -16
- package/docs/transaction.md +38 -37
- package/package.json +1 -1
- package/src/compat/__tests/BSM.test.ts +37 -37
- package/src/compat/__tests/ECIES.test.ts +71 -71
- package/src/compat/__tests/HD.test.ts +362 -362
- package/src/compat/__tests/Mnemonic.test.ts +147 -148
- package/src/compat/__tests/Mnemonic.vectors.ts +170 -170
- package/src/messages/__tests/EncryptedMessage.test.ts +16 -16
- package/src/primitives/Point.ts +29 -10
- package/src/primitives/Polynomial.ts +89 -0
- package/src/primitives/PrivateKey.ts +147 -1
- package/src/primitives/PublicKey.ts +17 -2
- package/src/primitives/__tests/AESGCM.test.ts +20 -20
- package/src/primitives/__tests/Hash.test.ts +2 -2
- package/src/primitives/__tests/PBKDF2.vectors.ts +93 -93
- package/src/primitives/__tests/PrivateKey.split.test.ts +70 -0
- package/src/primitives/__tests/PublicKey.test.ts +14 -1
- package/src/primitives/__tests/bug-31.test.ts +24 -26
- package/src/primitives/__tests/utils.test.ts +13 -13
- package/src/primitives/index.ts +2 -1
- package/src/primitives/utils.ts +1 -1
- package/src/script/__tests/Script.test.ts +1 -1
- package/src/script/__tests/SpendComplex.test.ts +6 -6
- package/src/script/__tests/script.invalid.vectors.ts +1464 -1464
- package/src/script/__tests/script.valid.vectors.ts +1962 -1962
- package/src/script/__tests/spend.valid.vectors.ts +1369 -1369
- package/src/script/templates/P2PKH.ts +6 -6
- package/src/script/templates/RPuzzle.ts +1 -1
- package/src/transaction/Transaction.ts +13 -7
- package/src/transaction/__tests/Transaction.test.ts +14 -5
- package/src/transaction/__tests/bump.invalid.vectors.ts +1 -1
- package/src/transaction/__tests/bump.valid.vectors.ts +3 -3
- package/src/transaction/broadcasters/ARC.ts +20 -21
- package/src/transaction/broadcasters/DefaultBroadcaster.ts +3 -3
- package/src/transaction/broadcasters/WhatsOnChainBroadcaster.ts +10 -10
- package/src/transaction/broadcasters/__tests/WhatsOnChainBroadcaster.test.ts +7 -10
- package/src/transaction/chaintrackers/DefaultChainTracker.ts +3 -3
- package/src/transaction/chaintrackers/WhatsOnChain.ts +10 -12
- package/src/transaction/chaintrackers/__tests/WhatsOnChainChainTracker.test.ts +13 -17
- package/src/transaction/fee-models/SatoshisPerKilobyte.ts +2 -2
- package/src/transaction/http/DefaultHttpClient.ts +13 -13
- package/src/transaction/http/FetchHttpClient.ts +14 -16
- package/src/transaction/http/HttpClient.ts +22 -23
- package/src/transaction/http/NodejsHttpClient.ts +23 -25
- package/src/transaction/http/index.ts +6 -6
|
@@ -1,172 +1,172 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
2
|
+
english: [
|
|
3
|
+
{
|
|
4
|
+
entropy: '00000000000000000000000000000000',
|
|
5
|
+
mnemonic: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about',
|
|
6
|
+
passphrase: 'TREZOR',
|
|
7
|
+
seed: 'c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04',
|
|
8
|
+
bip32_xprv: 'xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
entropy: '7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f',
|
|
12
|
+
mnemonic: 'legal winner thank year wave sausage worth useful legal winner thank yellow',
|
|
13
|
+
passphrase: 'TREZOR',
|
|
14
|
+
seed: '2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607',
|
|
15
|
+
bip32_xprv: 'xprv9s21ZrQH143K2gA81bYFHqU68xz1cX2APaSq5tt6MFSLeXnCKV1RVUJt9FWNTbrrryem4ZckN8k4Ls1H6nwdvDTvnV7zEXs2HgPezuVccsq'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
entropy: '80808080808080808080808080808080',
|
|
19
|
+
mnemonic: 'letter advice cage absurd amount doctor acoustic avoid letter advice cage above',
|
|
20
|
+
passphrase: 'TREZOR',
|
|
21
|
+
seed: 'd71de856f81a8acc65e6fc851a38d4d7ec216fd0796d0a6827a3ad6ed5511a30fa280f12eb2e47ed2ac03b5c462a0358d18d69fe4f985ec81778c1b370b652a8',
|
|
22
|
+
bip32_xprv: 'xprv9s21ZrQH143K2shfP28KM3nr5Ap1SXjz8gc2rAqqMEynmjt6o1qboCDpxckqXavCwdnYds6yBHZGKHv7ef2eTXy461PXUjBFQg6PrwY4Gzq'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
entropy: 'ffffffffffffffffffffffffffffffff',
|
|
26
|
+
mnemonic: 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong',
|
|
27
|
+
passphrase: 'TREZOR',
|
|
28
|
+
seed: 'ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069',
|
|
29
|
+
bip32_xprv: 'xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
entropy: '000000000000000000000000000000000000000000000000',
|
|
33
|
+
mnemonic: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon agent',
|
|
34
|
+
passphrase: 'TREZOR',
|
|
35
|
+
seed: '035895f2f481b1b0f01fcf8c289c794660b289981a78f8106447707fdd9666ca06da5a9a565181599b79f53b844d8a71dd9f439c52a3d7b3e8a79c906ac845fa',
|
|
36
|
+
bip32_xprv: 'xprv9s21ZrQH143K3mEDrypcZ2usWqFgzKB6jBBx9B6GfC7fu26X6hPRzVjzkqkPvDqp6g5eypdk6cyhGnBngbjeHTe4LsuLG1cCmKJka5SMkmU'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
entropy: '7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f',
|
|
40
|
+
mnemonic: 'legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will',
|
|
41
|
+
passphrase: 'TREZOR',
|
|
42
|
+
seed: 'f2b94508732bcbacbcc020faefecfc89feafa6649a5491b8c952cede496c214a0c7b3c392d168748f2d4a612bada0753b52a1c7ac53c1e93abd5c6320b9e95dd',
|
|
43
|
+
bip32_xprv: 'xprv9s21ZrQH143K3Lv9MZLj16np5GzLe7tDKQfVusBni7toqJGcnKRtHSxUwbKUyUWiwpK55g1DUSsw76TF1T93VT4gz4wt5RM23pkaQLnvBh7'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
entropy: '808080808080808080808080808080808080808080808080',
|
|
47
|
+
mnemonic: 'letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always',
|
|
48
|
+
passphrase: 'TREZOR',
|
|
49
|
+
seed: '107d7c02a5aa6f38c58083ff74f04c607c2d2c0ecc55501dadd72d025b751bc27fe913ffb796f841c49b1d33b610cf0e91d3aa239027f5e99fe4ce9e5088cd65',
|
|
50
|
+
bip32_xprv: 'xprv9s21ZrQH143K3VPCbxbUtpkh9pRG371UCLDz3BjceqP1jz7XZsQ5EnNkYAEkfeZp62cDNj13ZTEVG1TEro9sZ9grfRmcYWLBhCocViKEJae'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
entropy: 'ffffffffffffffffffffffffffffffffffffffffffffffff',
|
|
54
|
+
mnemonic: 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo when',
|
|
55
|
+
passphrase: 'TREZOR',
|
|
56
|
+
seed: '0cd6e5d827bb62eb8fc1e262254223817fd068a74b5b449cc2f667c3f1f985a76379b43348d952e2265b4cd129090758b3e3c2c49103b5051aac2eaeb890a528',
|
|
57
|
+
bip32_xprv: 'xprv9s21ZrQH143K36Ao5jHRVhFGDbLP6FCx8BEEmpru77ef3bmA928BxsqvVM27WnvvyfWywiFN8K6yToqMaGYfzS6Db1EHAXT5TuyCLBXUfdm'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
entropy: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
61
|
+
mnemonic: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art',
|
|
62
|
+
passphrase: 'TREZOR',
|
|
63
|
+
seed: 'bda85446c68413707090a52022edd26a1c9462295029f2e60cd7c4f2bbd3097170af7a4d73245cafa9c3cca8d561a7c3de6f5d4a10be8ed2a5e608d68f92fcc8',
|
|
64
|
+
bip32_xprv: 'xprv9s21ZrQH143K32qBagUJAMU2LsHg3ka7jqMcV98Y7gVeVyNStwYS3U7yVVoDZ4btbRNf4h6ibWpY22iRmXq35qgLs79f312g2kj5539ebPM'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
entropy: '7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f',
|
|
68
|
+
mnemonic: 'legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title',
|
|
69
|
+
passphrase: 'TREZOR',
|
|
70
|
+
seed: 'bc09fca1804f7e69da93c2f2028eb238c227f2e9dda30cd63699232578480a4021b146ad717fbb7e451ce9eb835f43620bf5c514db0f8add49f5d121449d3e87',
|
|
71
|
+
bip32_xprv: 'xprv9s21ZrQH143K3Y1sd2XVu9wtqxJRvybCfAetjUrMMco6r3v9qZTBeXiBZkS8JxWbcGJZyio8TrZtm6pkbzG8SYt1sxwNLh3Wx7to5pgiVFU'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
entropy: '8080808080808080808080808080808080808080808080808080808080808080',
|
|
75
|
+
mnemonic: 'letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless',
|
|
76
|
+
passphrase: 'TREZOR',
|
|
77
|
+
seed: 'c0c519bd0e91a2ed54357d9d1ebef6f5af218a153624cf4f2da911a0ed8f7a09e2ef61af0aca007096df430022f7a2b6fb91661a9589097069720d015e4e982f',
|
|
78
|
+
bip32_xprv: 'xprv9s21ZrQH143K3CSnQNYC3MqAAqHwxeTLhDbhF43A4ss4ciWNmCY9zQGvAKUSqVUf2vPHBTSE1rB2pg4avopqSiLVzXEU8KziNnVPauTqLRo'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
entropy: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
|
|
82
|
+
mnemonic: 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote',
|
|
83
|
+
passphrase: 'TREZOR',
|
|
84
|
+
seed: 'dd48c104698c30cfe2b6142103248622fb7bb0ff692eebb00089b32d22484e1613912f0a5b694407be899ffd31ed3992c456cdf60f5d4564b8ba3f05a69890ad',
|
|
85
|
+
bip32_xprv: 'xprv9s21ZrQH143K2WFF16X85T2QCpndrGwx6GueB72Zf3AHwHJaknRXNF37ZmDrtHrrLSHvbuRejXcnYxoZKvRquTPyp2JiNG3XcjQyzSEgqCB'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
entropy: '77c2b00716cec7213839159e404db50d',
|
|
89
|
+
mnemonic: 'jelly better achieve collect unaware mountain thought cargo oxygen act hood bridge',
|
|
90
|
+
passphrase: 'TREZOR',
|
|
91
|
+
seed: 'b5b6d0127db1a9d2226af0c3346031d77af31e918dba64287a1b44b8ebf63cdd52676f672a290aae502472cf2d602c051f3e6f18055e84e4c43897fc4e51a6ff',
|
|
92
|
+
bip32_xprv: 'xprv9s21ZrQH143K3xC5SRKnxV4R829AcnKE7XjZu2PixyZh3CexnsvmkBsi5rzqXMhxTkfLJFB6FuHJPWxxvcH5eYvCDvWcYAMXpbpGGiVUDfH'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
entropy: 'b63a9c59a6e641f288ebc103017f1da9f8290b3da6bdef7b',
|
|
96
|
+
mnemonic: 'renew stay biology evidence goat welcome casual join adapt armor shuffle fault little machine walk stumble urge swap',
|
|
97
|
+
passphrase: 'TREZOR',
|
|
98
|
+
seed: '9248d83e06f4cd98debf5b6f010542760df925ce46cf38a1bdb4e4de7d21f5c39366941c69e1bdbf2966e0f6e6dbece898a0e2f0a4c2b3e640953dfe8b7bbdc5',
|
|
99
|
+
bip32_xprv: 'xprv9s21ZrQH143K4YsWLquHbdGRh1mRrj5DTdRaj1cUrhftfXx4YJ3Zy41H52GR8nywKkpRSTdM71uZTRztscUdAAPL2Z6JQdW4xVPyzxh5zCG'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
entropy: '3e141609b97933b66a060dcddc71fad1d91677db872031e85f4c015c5e7e8982',
|
|
103
|
+
mnemonic: 'dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic',
|
|
104
|
+
passphrase: 'TREZOR',
|
|
105
|
+
seed: 'ff7f3184df8696d8bef94b6c03114dbee0ef89ff938712301d27ed8336ca89ef9635da20af07d4175f2bf5f3de130f39c9d9e8dd0472489c19b1a020a940da67',
|
|
106
|
+
bip32_xprv: 'xprv9s21ZrQH143K44JSkE9N3huFVGqK5YUroYxjd5eBotHvyBcDXNvjF3uxSiGDuGo7ub2GJgLc3HtvQbQkzies2qNjeM1p8nyTWEzNHuyVqss'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
entropy: '0460ef47585604c5660618db2e6a7e7f',
|
|
110
|
+
mnemonic: 'afford alter spike radar gate glance object seek swamp infant panel yellow',
|
|
111
|
+
passphrase: 'TREZOR',
|
|
112
|
+
seed: '65f93a9f36b6c85cbe634ffc1f99f2b82cbb10b31edc7f087b4f6cb9e976e9faf76ff41f8f27c99afdf38f7a303ba1136ee48a4c1e7fcd3dba7aa876113a36e4',
|
|
113
|
+
bip32_xprv: 'xprv9s21ZrQH143K2fzHWz7Z7PQj54R9Acrra9W28nnMLzgHonTebXnRD35dmvyaB41A1U1o59duUJ7dF9227Hr84AFY8aAeGNhnetXuecd6t67'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
entropy: '72f60ebac5dd8add8d2a25a797102c3ce21bc029c200076f',
|
|
117
|
+
mnemonic: 'indicate race push merry suffer human cruise dwarf pole review arch keep canvas theme poem divorce alter left',
|
|
118
|
+
passphrase: 'TREZOR',
|
|
119
|
+
seed: '3bbf9daa0dfad8229786ace5ddb4e00fa98a044ae4c4975ffd5e094dba9e0bb289349dbe2091761f30f382d4e35c4a670ee8ab50758d2c55881be69e327117ba',
|
|
120
|
+
bip32_xprv: 'xprv9s21ZrQH143K2gts9Sq6Aq67GTVeWXuJM1Eieknp95mWujAcuD2VixUsqaRuU9Hm3Z7Rh9JzukebGqwfbu6gJv42KRBvK4f4K9Cc84r7jaB'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
entropy: '2c85efc7f24ee4573d2b81a6ec66cee209b2dcbd09d8eddc51e0215b0b68e416',
|
|
124
|
+
mnemonic: 'clutch control vehicle tonight unusual clog visa ice plunge glimpse recipe series open hour vintage deposit universe tip job dress radar refuse motion taste',
|
|
125
|
+
passphrase: 'TREZOR',
|
|
126
|
+
seed: 'fe908f96f46668b2d5b37d82f558c77ed0d69dd0e7e043a5b0511c48c2f1064694a956f86360c93dd04052a8899497ce9e985ebe0c8c52b955e6ae86d4ff4449',
|
|
127
|
+
bip32_xprv: 'xprv9s21ZrQH143K39y7KHx56XraMbqrS7VBxVqSSCUhFvE8MsaBCr9T7zsZwNH7jvdcii9ToB91qvgeacds6ubaNU3TDxvY2bhZMmESAAssoYD'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
entropy: 'eaebabb2383351fd31d703840b32e9e2',
|
|
131
|
+
mnemonic: 'turtle front uncle idea crush write shrug there lottery flower risk shell',
|
|
132
|
+
passphrase: 'TREZOR',
|
|
133
|
+
seed: 'bdfb76a0759f301b0b899a1e3985227e53b3f51e67e3f2a65363caedf3e32fde42a66c404f18d7b05818c95ef3ca1e5146646856c461c073169467511680876c',
|
|
134
|
+
bip32_xprv: 'xprv9s21ZrQH143K2mweKbPaebAU2b8poVVeqRgi1UBPybm9pLoCRKGgFgD2LbLHvHNsXDk3n1zjT7RujoLyb9huymgMXZLtL2UWqBHgKxdTjFk'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
entropy: '7ac45cfe7722ee6c7ba84fbc2d5bd61b45cb2fe5eb65aa78',
|
|
138
|
+
mnemonic: 'kiss carry display unusual confirm curtain upgrade antique rotate hello void custom frequent obey nut hole price segment',
|
|
139
|
+
passphrase: 'TREZOR',
|
|
140
|
+
seed: 'ed56ff6c833c07982eb7119a8f48fd363c4a9b1601cd2de736b01045c5eb8ab4f57b079403485d1c4924f0790dc10a971763337cb9f9c62226f64fff26397c79',
|
|
141
|
+
bip32_xprv: 'xprv9s21ZrQH143K4M1N4f2Ma5YRADyBqU7wtb18qiZwWTk1rpx49XTsRCUa2iaPhDRBEVAMdGqDCn5iJTvsAUrPQ8NhVYdwZSf5mekdqwcRUS9'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
entropy: '4fa1a8bc3e6d80ee1316050e862c1812031493212b7ec3f3bb1b08f168cabeef',
|
|
145
|
+
mnemonic: 'exile ask congress lamp submit jacket era scheme attend cousin alcohol catch course end lucky hurt sentence oven short ball bird grab wing top',
|
|
146
|
+
passphrase: 'TREZOR',
|
|
147
|
+
seed: '095ee6f817b4c2cb30a5a797360a81a40ab0f9a4e25ecd672a3f58a0b5ba0687c096a6b14d2c0deb3bdefce4f61d01ae07417d502429352e27695163f7447a8c',
|
|
148
|
+
bip32_xprv: 'xprv9s21ZrQH143K3BDzEvudRjun23x1nqxchPCmyTsRBNmUZwFP6Hsim6UnwpcEA6De2kVpC6UDoVKUFFh9h47cY4DL5363KwwvGQ3jVzU6rXP'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
entropy: '18ab19a9f54a9274f03e5209a2ac8a91',
|
|
152
|
+
mnemonic: 'board flee heavy tunnel powder denial science ski answer betray cargo cat',
|
|
153
|
+
passphrase: 'TREZOR',
|
|
154
|
+
seed: '6eff1bb21562918509c73cb990260db07c0ce34ff0e3cc4a8cb3276129fbcb300bddfe005831350efd633909f476c45c88253276d9fd0df6ef48609e8bb7dca8',
|
|
155
|
+
bip32_xprv: 'xprv9s21ZrQH143K2fopRUQMvgrFpXJHmAbGYfwdpKcRh9cp9E2aHDbQA5V9mXRwCRj2nzjwpAXH4sdhGV8xJxpv2BEZxEJrSDsdqwAYBXcF3eu'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
entropy: '18a2e1d81b8ecfb2a333adcb0c17a5b9eb76cc5d05db91a4',
|
|
159
|
+
mnemonic: 'board blade invite damage undo sun mimic interest slam gaze truly inherit resist great inject rocket museum chief',
|
|
160
|
+
passphrase: 'TREZOR',
|
|
161
|
+
seed: 'f84521c777a13b61564234bf8f8b62b3afce27fc4062b51bb5e62bdfecb23864ee6ecf07c1d5a97c0834307c5c852d8ceb88e7c97923c0a3b496bedd4e5f88a9',
|
|
162
|
+
bip32_xprv: 'xprv9s21ZrQH143K38yVDKj2uhq6e6jXBtMQATbysyZUGyG14JHvFRsHnvEDsW1xMedAm56UYZzwTDLL33ntWgTLkrynyvE4FLDP4DZpJRbMhMn'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
entropy: '15da872c95a13dd738fbf50e427583ad61f18fd99f628c417a61cf8343c90419',
|
|
166
|
+
mnemonic: 'beyond stage sleep clip because twist token leaf atom beauty genius food business side grid unable middle armed observe pair crouch tonight away coconut',
|
|
167
|
+
passphrase: 'TREZOR',
|
|
168
|
+
seed: 'b15509eaa2d09d3efd3e006ef42151b30367dc6e3aa5e44caba3fe4d3e352e65101fbdb86a96776b91946ff06f8eac594dc6ee1d3e82a42dfe1b40fef6bcc3fd',
|
|
169
|
+
bip32_xprv: 'xprv9s21ZrQH143K47KSAu4o7EV43wqj2sxVHSHGLmY4ZThKffiHSBN2CNb8RtY6sdaNKZKq7mxa9WS3Kv2iBKtGkmD3L9iDBq1x959Uq3hKM32'
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
172
|
}
|
|
@@ -16,23 +16,23 @@ describe('EncryptedMessage', () => {
|
|
|
16
16
|
{
|
|
17
17
|
// Rare length case... Leading zeros in key BigNumber array.
|
|
18
18
|
const encrypted = [
|
|
19
|
-
66,66,16,51,2,215,146,77,79,125,
|
|
20
|
-
67,234,150,90,70,90,227,9,95,244,
|
|
21
|
-
17,49,229,148,111,60,133,247,158,68,
|
|
22
|
-
173,188,248,226,126,8,14,2,53,43,
|
|
23
|
-
191,74,76,221,18,86,79,147,250,51,
|
|
24
|
-
44,227,51,48,29,154,212,2,113,248,
|
|
25
|
-
16,113,129,52,10,239,37,190,89,213,
|
|
19
|
+
66, 66, 16, 51, 2, 215, 146, 77, 79, 125,
|
|
20
|
+
67, 234, 150, 90, 70, 90, 227, 9, 95, 244,
|
|
21
|
+
17, 49, 229, 148, 111, 60, 133, 247, 158, 68,
|
|
22
|
+
173, 188, 248, 226, 126, 8, 14, 2, 53, 43,
|
|
23
|
+
191, 74, 76, 221, 18, 86, 79, 147, 250, 51,
|
|
24
|
+
44, 227, 51, 48, 29, 154, 212, 2, 113, 248,
|
|
25
|
+
16, 113, 129, 52, 10, 239, 37, 190, 89, 213,
|
|
26
26
|
|
|
27
|
-
75,148,8,235,104,137,80,129,55,68,
|
|
28
|
-
182,141,118,212,215,121,161,107,62,247,
|
|
29
|
-
12,172,244,170,208,37,213,198,103,118,
|
|
30
|
-
75,166,166,131,191,105,48,232,101,223,
|
|
31
|
-
255,169,176,204,126,249,78,178,10,51,
|
|
32
|
-
13,163,58,232,122,111,210,218,187,247,
|
|
33
|
-
164,101,207,15,37,227,108,82,70,35,
|
|
34
|
-
5,148,18,162,120,64,46,40,227,197,
|
|
35
|
-
6,112,207,200,238,81
|
|
27
|
+
75, 148, 8, 235, 104, 137, 80, 129, 55, 68,
|
|
28
|
+
182, 141, 118, 212, 215, 121, 161, 107, 62, 247,
|
|
29
|
+
12, 172, 244, 170, 208, 37, 213, 198, 103, 118,
|
|
30
|
+
75, 166, 166, 131, 191, 105, 48, 232, 101, 223,
|
|
31
|
+
255, 169, 176, 204, 126, 249, 78, 178, 10, 51,
|
|
32
|
+
13, 163, 58, 232, 122, 111, 210, 218, 187, 247,
|
|
33
|
+
164, 101, 207, 15, 37, 227, 108, 82, 70, 35,
|
|
34
|
+
5, 148, 18, 162, 120, 64, 46, 40, 227, 197,
|
|
35
|
+
6, 112, 207, 200, 238, 81
|
|
36
36
|
]
|
|
37
37
|
expect(() => decrypt(encrypted, recipient)).not.toThrow()
|
|
38
38
|
}
|
package/src/primitives/Point.ts
CHANGED
|
@@ -22,26 +22,23 @@ export default class Point extends BasePoint {
|
|
|
22
22
|
inf: boolean
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Creates a point object from a given
|
|
25
|
+
* Creates a point object from a given Array. These numbers can represent coordinates in hex format, or points
|
|
26
26
|
* in multiple established formats.
|
|
27
27
|
* The function verifies the integrity of the provided data and throws errors if inconsistencies are found.
|
|
28
28
|
*
|
|
29
|
-
* @method
|
|
29
|
+
* @method fromDER
|
|
30
30
|
* @static
|
|
31
|
-
* @param
|
|
31
|
+
* @param bytes - The point representation number array.
|
|
32
32
|
* @returns Returns a new point representing the given string.
|
|
33
|
-
* @throws `Error` If the point
|
|
33
|
+
* @throws `Error` If the point number[] value has a wrong length.
|
|
34
34
|
* @throws `Error` If the point format is unknown.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
|
-
* const
|
|
38
|
-
* const point = Point.
|
|
37
|
+
* const derPoint = [ 2, 18, 123, 108, 125, 83, 1, 251, 164, 214, 16, 119, 200, 216, 210, 193, 251, 193, 129, 67, 97, 146, 210, 216, 77, 254, 18, 6, 150, 190, 99, 198, 128 ];
|
|
38
|
+
* const point = Point.fromDER(derPoint);
|
|
39
39
|
*/
|
|
40
|
-
static
|
|
41
|
-
const bytes = toArray(str, 'hex')
|
|
42
|
-
|
|
40
|
+
static fromDER (bytes: number[]): Point {
|
|
43
41
|
const len = 32
|
|
44
|
-
|
|
45
42
|
// uncompressed, hybrid-odd, hybrid-even
|
|
46
43
|
if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
|
|
47
44
|
bytes.length - 1 === 2 * len) {
|
|
@@ -68,6 +65,28 @@ export default class Point extends BasePoint {
|
|
|
68
65
|
throw new Error('Unknown point format')
|
|
69
66
|
}
|
|
70
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Creates a point object from a given string. This string can represent coordinates in hex format, or points
|
|
70
|
+
* in multiple established formats.
|
|
71
|
+
* The function verifies the integrity of the provided data and throws errors if inconsistencies are found.
|
|
72
|
+
*
|
|
73
|
+
* @method fromString
|
|
74
|
+
* @static
|
|
75
|
+
*
|
|
76
|
+
* @param str The point representation string.
|
|
77
|
+
* @returns Returns a new point representing the given string.
|
|
78
|
+
* @throws `Error` If the point string value has a wrong length.
|
|
79
|
+
* @throws `Error` If the point format is unknown.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const pointStr = 'abcdef';
|
|
83
|
+
* const point = Point.fromString(pointStr);
|
|
84
|
+
*/
|
|
85
|
+
static fromString (str: string): Point {
|
|
86
|
+
const bytes = toArray(str, 'hex')
|
|
87
|
+
return Point.fromDER(bytes)
|
|
88
|
+
}
|
|
89
|
+
|
|
71
90
|
/**
|
|
72
91
|
* Generates a point from an x coordinate and a boolean indicating whether the corresponding
|
|
73
92
|
* y coordinate is odd.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import PrivateKey from './PrivateKey.js'
|
|
2
|
+
import BigNumber from './BigNumber.js'
|
|
3
|
+
import Curve from './Curve.js'
|
|
4
|
+
import Random from './Random.js'
|
|
5
|
+
import { fromBase58, toBase58 } from './utils.js'
|
|
6
|
+
|
|
7
|
+
export class PointInFiniteField {
|
|
8
|
+
x: BigNumber
|
|
9
|
+
y: BigNumber
|
|
10
|
+
|
|
11
|
+
constructor (x: BigNumber, y: BigNumber) {
|
|
12
|
+
const P = new Curve().p // arithmetic is mod P
|
|
13
|
+
this.x = x.umod(P)
|
|
14
|
+
this.y = y.umod(P)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toString (): string {
|
|
18
|
+
return toBase58(this.x.toArray()) + '.' + toBase58(this.y.toArray())
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static fromString (str: string): PointInFiniteField {
|
|
22
|
+
const [x, y] = str.split('.')
|
|
23
|
+
return new PointInFiniteField(new BigNumber(fromBase58(x)), new BigNumber(fromBase58(y)))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Polynomial class
|
|
29
|
+
*
|
|
30
|
+
* This class is used to create a polynomial with a given threshold and a private key.
|
|
31
|
+
* The polynomial is used to create shares of the private key.
|
|
32
|
+
*
|
|
33
|
+
* @param key - The private key to split
|
|
34
|
+
* @param threshold - The number of shares required to recombine the private key
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const key = new PrivateKey()
|
|
38
|
+
* const threshold = 2
|
|
39
|
+
* const polynomial = new Polynomial(key, threshold)
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export default class Polynomial {
|
|
43
|
+
readonly points: PointInFiniteField[]
|
|
44
|
+
readonly threshold: number
|
|
45
|
+
|
|
46
|
+
constructor (points: PointInFiniteField[], threshold?: number) {
|
|
47
|
+
this.points = points
|
|
48
|
+
this.threshold = threshold || points.length
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static fromPrivateKey (key: PrivateKey, threshold: number): Polynomial {
|
|
52
|
+
const P = new Curve().p // arithmetic is mod P
|
|
53
|
+
// The key is the y-intercept of the polynomial where x=0.
|
|
54
|
+
const points = [new PointInFiniteField(new BigNumber(0), new BigNumber(key.toArray()))]
|
|
55
|
+
|
|
56
|
+
// The other values are random
|
|
57
|
+
for (let i = 1; i < threshold; i++) {
|
|
58
|
+
const randomX = new BigNumber(Random(32)).umod(P)
|
|
59
|
+
const randomY = new BigNumber(Random(32)).umod(P)
|
|
60
|
+
points.push(new PointInFiniteField(randomX, randomY))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new Polynomial(points)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Evaluate the polynomial at x by using Lagrange interpolation
|
|
67
|
+
valueAt (x: BigNumber): BigNumber {
|
|
68
|
+
const P = new Curve().p // arithmetic is mod P
|
|
69
|
+
let y = new BigNumber(0)
|
|
70
|
+
for (let i = 0; i < this.threshold; i++) {
|
|
71
|
+
let term = this.points[i].y
|
|
72
|
+
for (let j = 0; j < this.threshold; j++) {
|
|
73
|
+
if (i !== j) {
|
|
74
|
+
const xj = this.points[j].x
|
|
75
|
+
const xi = this.points[i].x
|
|
76
|
+
|
|
77
|
+
const numerator = x.sub(xj).umod(P)
|
|
78
|
+
const denominator = xi.sub(xj).umod(P)
|
|
79
|
+
const denominatorInverse = denominator.invm(P)
|
|
80
|
+
|
|
81
|
+
const fraction = numerator.mul(denominatorInverse).umod(P)
|
|
82
|
+
term = term.mul(fraction).umod(P)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
y = y.add(term).umod(P)
|
|
86
|
+
}
|
|
87
|
+
return y
|
|
88
|
+
}
|
|
89
|
+
}
|