@forgezero/runtime 0.1.7 → 0.1.8
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/README.md +357 -118
- package/dist/custody-share.js +12 -0
- package/dist/phrase.d.ts +1 -1
- package/package.json +260 -261
package/dist/custody-share.js
CHANGED
|
@@ -191,6 +191,15 @@ var fromBase642 = (value) => {
|
|
|
191
191
|
bytes[index] = binary.charCodeAt(index);
|
|
192
192
|
return bytes;
|
|
193
193
|
};
|
|
194
|
+
var equalVerifier = (left, right) => {
|
|
195
|
+
if (left.length !== right.length)
|
|
196
|
+
return false;
|
|
197
|
+
let difference = 0;
|
|
198
|
+
for (let index = 0;index < left.length; index += 1) {
|
|
199
|
+
difference |= left.charCodeAt(index) ^ right.charCodeAt(index);
|
|
200
|
+
}
|
|
201
|
+
return difference === 0;
|
|
202
|
+
};
|
|
194
203
|
function passkeyKey(custodianKey, prfOutput) {
|
|
195
204
|
if (!(prfOutput instanceof Uint8Array) || prfOutput.length < MIN_PRF_BYTES) {
|
|
196
205
|
throw new Error(`custody-share: PRF output must be at least ${MIN_PRF_BYTES} bytes`);
|
|
@@ -250,6 +259,9 @@ function openShareWithPhrase(sealed, custodianKey, phraseWords) {
|
|
|
250
259
|
if (!validatePhrase(phraseWords))
|
|
251
260
|
throw new Error("INVALID_PHRASE");
|
|
252
261
|
const salt = fromBase642(sealed.phraseSalt);
|
|
262
|
+
const offered = phraseVerifier(phraseWords, salt);
|
|
263
|
+
if (!equalVerifier(offered, sealed.phraseVerifier))
|
|
264
|
+
throw new Error("PHRASE_MISMATCH");
|
|
253
265
|
const key = phraseToKey(phraseWords, salt);
|
|
254
266
|
try {
|
|
255
267
|
return openWithKey(key, sealed.phraseEnvelope, shareAad(custodianKey, "phrase", sealed.shareIndex));
|
package/dist/phrase.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Every custodian gets a passkey AND a 24-word phrase. The passkey is the day
|
|
5
5
|
* to day factor; the phrase is what still works when the laptop holding the
|
|
6
|
-
* passkey is lost, wiped or dead. See share
|
|
6
|
+
* passkey is lost, wiped or dead. See custody-share.ts for how the two are
|
|
7
7
|
* combined (they are alternatives, not a chain).
|
|
8
8
|
*
|
|
9
9
|
* ── Why BIP-39, and why 24 words ─────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,265 +1,264 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
|
|
2
|
+
"name": "@forgezero/runtime",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
|
-
"provenance":
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
]
|
|
7
|
+
"provenance": false
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
"./jobs": {
|
|
11
|
+
"types": "./dist/jobs.d.ts",
|
|
12
|
+
"default": "./dist/jobs.js"
|
|
13
|
+
},
|
|
14
|
+
"./queue": {
|
|
15
|
+
"types": "./dist/queue.d.ts",
|
|
16
|
+
"default": "./dist/queue.js"
|
|
17
|
+
},
|
|
18
|
+
"./outbox": {
|
|
19
|
+
"types": "./dist/outbox.d.ts",
|
|
20
|
+
"default": "./dist/outbox.js"
|
|
21
|
+
},
|
|
22
|
+
"./audit": {
|
|
23
|
+
"types": "./dist/audit.d.ts",
|
|
24
|
+
"default": "./dist/audit.js"
|
|
25
|
+
},
|
|
26
|
+
"./backup": {
|
|
27
|
+
"types": "./dist/backup.d.ts",
|
|
28
|
+
"default": "./dist/backup.js"
|
|
29
|
+
},
|
|
30
|
+
"./notify": {
|
|
31
|
+
"types": "./dist/notify.d.ts",
|
|
32
|
+
"default": "./dist/notify.js"
|
|
33
|
+
},
|
|
34
|
+
"./notify/templates": {
|
|
35
|
+
"types": "./dist/notify-templates.d.ts",
|
|
36
|
+
"default": "./dist/notify-templates.js"
|
|
37
|
+
},
|
|
38
|
+
"./schema": {
|
|
39
|
+
"types": "./dist/schema.d.ts",
|
|
40
|
+
"default": "./dist/schema.js"
|
|
41
|
+
},
|
|
42
|
+
"./schema/typebox": {
|
|
43
|
+
"types": "./dist/schema-typebox.d.ts",
|
|
44
|
+
"default": "./dist/schema-typebox.js"
|
|
45
|
+
},
|
|
46
|
+
"./query": {
|
|
47
|
+
"types": "./dist/query.d.ts",
|
|
48
|
+
"default": "./dist/query.js"
|
|
49
|
+
},
|
|
50
|
+
"./realtime": {
|
|
51
|
+
"types": "./dist/realtime.d.ts",
|
|
52
|
+
"default": "./dist/realtime.js"
|
|
53
|
+
},
|
|
54
|
+
"./calendar": {
|
|
55
|
+
"types": "./dist/calendar.d.ts",
|
|
56
|
+
"default": "./dist/calendar.js"
|
|
57
|
+
},
|
|
58
|
+
"./identity": {
|
|
59
|
+
"types": "./dist/identity.d.ts",
|
|
60
|
+
"default": "./dist/identity.js"
|
|
61
|
+
},
|
|
62
|
+
"./passkey-hybrid": {
|
|
63
|
+
"types": "./dist/passkey-hybrid.d.ts",
|
|
64
|
+
"default": "./dist/passkey-hybrid.js"
|
|
65
|
+
},
|
|
66
|
+
"./totp": {
|
|
67
|
+
"types": "./dist/totp.d.ts",
|
|
68
|
+
"default": "./dist/totp.js"
|
|
69
|
+
},
|
|
70
|
+
"./otpauth": {
|
|
71
|
+
"types": "./dist/otpauth.d.ts",
|
|
72
|
+
"default": "./dist/otpauth.js"
|
|
73
|
+
},
|
|
74
|
+
"./pipeline": {
|
|
75
|
+
"types": "./dist/pipeline.d.ts",
|
|
76
|
+
"default": "./dist/pipeline.js"
|
|
77
|
+
},
|
|
78
|
+
"./compliance": {
|
|
79
|
+
"types": "./dist/compliance.d.ts",
|
|
80
|
+
"default": "./dist/compliance.js"
|
|
81
|
+
},
|
|
82
|
+
"./finance/discounts": {
|
|
83
|
+
"types": "./dist/finance/discounts.d.ts",
|
|
84
|
+
"default": "./dist/finance/discounts.js"
|
|
85
|
+
},
|
|
86
|
+
"./finance/money": {
|
|
87
|
+
"types": "./dist/finance/money.d.ts",
|
|
88
|
+
"default": "./dist/finance/money.js"
|
|
89
|
+
},
|
|
90
|
+
"./finance/storage": {
|
|
91
|
+
"types": "./dist/finance/storage.d.ts",
|
|
92
|
+
"default": "./dist/finance/storage.js"
|
|
93
|
+
},
|
|
94
|
+
"./finance/custody": {
|
|
95
|
+
"types": "./dist/finance/custody.d.ts",
|
|
96
|
+
"default": "./dist/finance/custody.js"
|
|
97
|
+
},
|
|
98
|
+
"./finance/tax": {
|
|
99
|
+
"types": "./dist/finance/tax.d.ts",
|
|
100
|
+
"default": "./dist/finance/tax.js"
|
|
101
|
+
},
|
|
102
|
+
"./finance/derive": {
|
|
103
|
+
"types": "./dist/finance/derive.d.ts",
|
|
104
|
+
"default": "./dist/finance/derive.js"
|
|
105
|
+
},
|
|
106
|
+
"./finance/venues": {
|
|
107
|
+
"types": "./dist/finance/venues.d.ts",
|
|
108
|
+
"default": "./dist/finance/venues.js"
|
|
109
|
+
},
|
|
110
|
+
"./finance/ledger": {
|
|
111
|
+
"types": "./dist/finance/ledger.d.ts",
|
|
112
|
+
"default": "./dist/finance/ledger.js"
|
|
113
|
+
},
|
|
114
|
+
"./finance/rates": {
|
|
115
|
+
"types": "./dist/finance/rates.d.ts",
|
|
116
|
+
"default": "./dist/finance/rates.js"
|
|
117
|
+
},
|
|
118
|
+
"./finance/transfers": {
|
|
119
|
+
"types": "./dist/finance/transfers.d.ts",
|
|
120
|
+
"default": "./dist/finance/transfers.js"
|
|
121
|
+
},
|
|
122
|
+
"./finance/chain": {
|
|
123
|
+
"types": "./dist/finance/chain.d.ts",
|
|
124
|
+
"default": "./dist/finance/chain.js"
|
|
125
|
+
},
|
|
126
|
+
"./finance/chain-addresses": {
|
|
127
|
+
"types": "./dist/finance/chain-addresses.d.ts",
|
|
128
|
+
"default": "./dist/finance/chain-addresses.js"
|
|
129
|
+
},
|
|
130
|
+
"./finance/chain-deposits": {
|
|
131
|
+
"types": "./dist/finance/chain-deposits.d.ts",
|
|
132
|
+
"default": "./dist/finance/chain-deposits.js"
|
|
133
|
+
},
|
|
134
|
+
"./finance/chain-withdrawals": {
|
|
135
|
+
"types": "./dist/finance/chain-withdrawals.d.ts",
|
|
136
|
+
"default": "./dist/finance/chain-withdrawals.js"
|
|
137
|
+
},
|
|
138
|
+
"./finance/chain-reconcile": {
|
|
139
|
+
"types": "./dist/finance/chain-reconcile.d.ts",
|
|
140
|
+
"default": "./dist/finance/chain-reconcile.js"
|
|
141
|
+
},
|
|
142
|
+
"./finance/market": {
|
|
143
|
+
"types": "./dist/finance/market.d.ts",
|
|
144
|
+
"default": "./dist/finance/market.js"
|
|
145
|
+
},
|
|
146
|
+
"./finance/commission": {
|
|
147
|
+
"types": "./dist/finance/commission.d.ts",
|
|
148
|
+
"default": "./dist/finance/commission.js"
|
|
149
|
+
},
|
|
150
|
+
"./passkey": {
|
|
151
|
+
"types": "./dist/passkey.d.ts",
|
|
152
|
+
"default": "./dist/passkey.js"
|
|
153
|
+
},
|
|
154
|
+
"./custody-share": {
|
|
155
|
+
"types": "./dist/custody-share.d.ts",
|
|
156
|
+
"default": "./dist/custody-share.js"
|
|
157
|
+
},
|
|
158
|
+
"./custody-crypto": {
|
|
159
|
+
"types": "./dist/custody-crypto.d.ts",
|
|
160
|
+
"default": "./dist/custody-crypto.js"
|
|
161
|
+
},
|
|
162
|
+
"./phrase": {
|
|
163
|
+
"types": "./dist/phrase.d.ts",
|
|
164
|
+
"default": "./dist/phrase.js"
|
|
165
|
+
},
|
|
166
|
+
"./slip10": {
|
|
167
|
+
"types": "./dist/slip10.d.ts",
|
|
168
|
+
"default": "./dist/slip10.js"
|
|
169
|
+
},
|
|
170
|
+
"./ssh-cert": {
|
|
171
|
+
"types": "./dist/ssh-cert.d.ts",
|
|
172
|
+
"default": "./dist/ssh-cert.js"
|
|
173
|
+
},
|
|
174
|
+
"./openssh": {
|
|
175
|
+
"types": "./dist/openssh.d.ts",
|
|
176
|
+
"default": "./dist/openssh.js"
|
|
177
|
+
},
|
|
178
|
+
"./importers": {
|
|
179
|
+
"types": "./dist/importers.d.ts",
|
|
180
|
+
"default": "./dist/importers.js"
|
|
181
|
+
},
|
|
182
|
+
"./snp": {
|
|
183
|
+
"types": "./dist/snp.d.ts",
|
|
184
|
+
"default": "./dist/snp.js"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"scripts": {
|
|
188
|
+
"check": "tsc --noEmit",
|
|
189
|
+
"build": "bun ../tools/package-task.ts build runtime",
|
|
190
|
+
"prepublishOnly": "bun ../tools/package-task.ts prepublish runtime"
|
|
191
|
+
},
|
|
192
|
+
"dependencies": {
|
|
193
|
+
"@forgezero/access": "^0.1.4"
|
|
194
|
+
},
|
|
195
|
+
"peerDependencies": {
|
|
196
|
+
"@noble/ciphers": "^2.2.0",
|
|
197
|
+
"@noble/curves": "^2.2.0",
|
|
198
|
+
"@noble/post-quantum": "^0.6.1",
|
|
199
|
+
"@noble/hashes": "^2.2.0",
|
|
200
|
+
"@sinclair/typebox": "^0.34.0",
|
|
201
|
+
"@scure/bip39": "^2.2.0"
|
|
202
|
+
},
|
|
203
|
+
"peerDependenciesMeta": {
|
|
204
|
+
"@noble/ciphers": {
|
|
205
|
+
"optional": true
|
|
206
|
+
},
|
|
207
|
+
"@noble/curves": {
|
|
208
|
+
"optional": true
|
|
209
|
+
},
|
|
210
|
+
"@noble/post-quantum": {
|
|
211
|
+
"optional": true
|
|
212
|
+
},
|
|
213
|
+
"@noble/hashes": {
|
|
214
|
+
"optional": true
|
|
215
|
+
},
|
|
216
|
+
"@sinclair/typebox": {
|
|
217
|
+
"optional": true
|
|
218
|
+
},
|
|
219
|
+
"@scure/bip39": {
|
|
220
|
+
"optional": true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"devDependencies": {
|
|
224
|
+
"typescript": "^5.6.0",
|
|
225
|
+
"@types/bun": "latest",
|
|
226
|
+
"@sinclair/typebox": "^0.34.0",
|
|
227
|
+
"@noble/curves": "^2.2.0",
|
|
228
|
+
"@noble/post-quantum": "^0.6.1",
|
|
229
|
+
"@scure/bip39": "^2.2.0"
|
|
230
|
+
},
|
|
231
|
+
"description": "The machinery a service needs behind its request handlers: jobs, keyed queues, a transactional outbox, a hash-chained audit trail, templated mail, encrypted backups and schema validation.",
|
|
232
|
+
"keywords": [
|
|
233
|
+
"jobs",
|
|
234
|
+
"scheduler",
|
|
235
|
+
"queue",
|
|
236
|
+
"outbox",
|
|
237
|
+
"audit",
|
|
238
|
+
"hash-chain",
|
|
239
|
+
"backup",
|
|
240
|
+
"notifications",
|
|
241
|
+
"json-schema",
|
|
242
|
+
"validation",
|
|
243
|
+
"calendar",
|
|
244
|
+
"billing-period",
|
|
245
|
+
"working-days"
|
|
246
|
+
],
|
|
247
|
+
"license": "MIT",
|
|
248
|
+
"homepage": "https://www.forgezero.net/docs/runtime",
|
|
249
|
+
"repository": {
|
|
250
|
+
"type": "git",
|
|
251
|
+
"url": "git+https://github.com/forgezero-net/packages.git",
|
|
252
|
+
"directory": "runtime"
|
|
253
|
+
},
|
|
254
|
+
"bugs": "https://github.com/forgezero-net/packages/issues",
|
|
255
|
+
"sideEffects": false,
|
|
256
|
+
"files": [
|
|
257
|
+
"dist",
|
|
258
|
+
"README.md",
|
|
259
|
+
"LICENSE",
|
|
260
|
+
"contracts/src",
|
|
261
|
+
"contracts/test",
|
|
262
|
+
"contracts/foundry.toml"
|
|
263
|
+
]
|
|
265
264
|
}
|