@hesohq/verify-wasm 0.4.3 → 0.5.0
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/heso_wasm.d.ts +387 -43
- package/heso_wasm.js +1293 -243
- package/heso_wasm_bg.wasm +0 -0
- package/heso_wasm_bg.wasm.d.ts +93 -43
- package/package.json +9 -2
package/heso_wasm.js
CHANGED
|
@@ -29,12 +29,16 @@ export class ActionVerdict {
|
|
|
29
29
|
let deferred1_0;
|
|
30
30
|
let deferred1_1;
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33
|
+
wasm.__wbg_get_actionverdict_trust_level(retptr, this.__wbg_ptr);
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
deferred1_0 = r0;
|
|
37
|
+
deferred1_1 = r1;
|
|
38
|
+
return getStringFromWasm0(r0, r1);
|
|
36
39
|
} finally {
|
|
37
|
-
wasm.
|
|
40
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
41
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
@@ -46,12 +50,16 @@ export class ActionVerdict {
|
|
|
46
50
|
let deferred1_0;
|
|
47
51
|
let deferred1_1;
|
|
48
52
|
try {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
54
|
+
wasm.__wbg_get_actionverdict_verdict(retptr, this.__wbg_ptr);
|
|
55
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
56
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
57
|
+
deferred1_0 = r0;
|
|
58
|
+
deferred1_1 = r1;
|
|
59
|
+
return getStringFromWasm0(r0, r1);
|
|
53
60
|
} finally {
|
|
54
|
-
wasm.
|
|
61
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
62
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
/**
|
|
@@ -60,7 +68,7 @@ export class ActionVerdict {
|
|
|
60
68
|
* @param {string} arg0
|
|
61
69
|
*/
|
|
62
70
|
set trust_level(arg0) {
|
|
63
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
71
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
64
72
|
const len0 = WASM_VECTOR_LEN;
|
|
65
73
|
wasm.__wbg_set_actionverdict_trust_level(this.__wbg_ptr, ptr0, len0);
|
|
66
74
|
}
|
|
@@ -70,7 +78,7 @@ export class ActionVerdict {
|
|
|
70
78
|
* @param {string} arg0
|
|
71
79
|
*/
|
|
72
80
|
set verdict(arg0) {
|
|
73
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
81
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
74
82
|
const len0 = WASM_VECTOR_LEN;
|
|
75
83
|
wasm.__wbg_set_actionverdict_verdict(this.__wbg_ptr, ptr0, len0);
|
|
76
84
|
}
|
|
@@ -105,12 +113,16 @@ export class ApprovalTokenClaims {
|
|
|
105
113
|
let deferred1_0;
|
|
106
114
|
let deferred1_1;
|
|
107
115
|
try {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
117
|
+
wasm.__wbg_get_approvaltokenclaims_approver_public_key(retptr, this.__wbg_ptr);
|
|
118
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
119
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
120
|
+
deferred1_0 = r0;
|
|
121
|
+
deferred1_1 = r1;
|
|
122
|
+
return getStringFromWasm0(r0, r1);
|
|
112
123
|
} finally {
|
|
113
|
-
wasm.
|
|
124
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
125
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
128
|
/**
|
|
@@ -121,12 +133,16 @@ export class ApprovalTokenClaims {
|
|
|
121
133
|
let deferred1_0;
|
|
122
134
|
let deferred1_1;
|
|
123
135
|
try {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
136
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
137
|
+
wasm.__wbg_get_approvaltokenclaims_decision(retptr, this.__wbg_ptr);
|
|
138
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
139
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140
|
+
deferred1_0 = r0;
|
|
141
|
+
deferred1_1 = r1;
|
|
142
|
+
return getStringFromWasm0(r0, r1);
|
|
128
143
|
} finally {
|
|
129
|
-
wasm.
|
|
144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
145
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
130
146
|
}
|
|
131
147
|
}
|
|
132
148
|
/**
|
|
@@ -135,7 +151,7 @@ export class ApprovalTokenClaims {
|
|
|
135
151
|
*/
|
|
136
152
|
get expiry_unix_secs() {
|
|
137
153
|
const ret = wasm.__wbg_get_approvaltokenclaims_expiry_unix_secs(this.__wbg_ptr);
|
|
138
|
-
return ret;
|
|
154
|
+
return takeObject(ret);
|
|
139
155
|
}
|
|
140
156
|
/**
|
|
141
157
|
* The 32-byte random nonce as a `Uint8Array`.
|
|
@@ -143,7 +159,7 @@ export class ApprovalTokenClaims {
|
|
|
143
159
|
*/
|
|
144
160
|
get nonce() {
|
|
145
161
|
const ret = wasm.__wbg_get_approvaltokenclaims_nonce(this.__wbg_ptr);
|
|
146
|
-
return ret;
|
|
162
|
+
return takeObject(ret);
|
|
147
163
|
}
|
|
148
164
|
/**
|
|
149
165
|
* The scope string encoded in the token.
|
|
@@ -153,12 +169,16 @@ export class ApprovalTokenClaims {
|
|
|
153
169
|
let deferred1_0;
|
|
154
170
|
let deferred1_1;
|
|
155
171
|
try {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
173
|
+
wasm.__wbg_get_approvaltokenclaims_scope(retptr, this.__wbg_ptr);
|
|
174
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
175
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
176
|
+
deferred1_0 = r0;
|
|
177
|
+
deferred1_1 = r1;
|
|
178
|
+
return getStringFromWasm0(r0, r1);
|
|
160
179
|
} finally {
|
|
161
|
-
wasm.
|
|
180
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
181
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
162
182
|
}
|
|
163
183
|
}
|
|
164
184
|
/**
|
|
@@ -166,7 +186,7 @@ export class ApprovalTokenClaims {
|
|
|
166
186
|
* @param {string} arg0
|
|
167
187
|
*/
|
|
168
188
|
set approver_public_key(arg0) {
|
|
169
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
189
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
170
190
|
const len0 = WASM_VECTOR_LEN;
|
|
171
191
|
wasm.__wbg_set_approvaltokenclaims_approver_public_key(this.__wbg_ptr, ptr0, len0);
|
|
172
192
|
}
|
|
@@ -175,7 +195,7 @@ export class ApprovalTokenClaims {
|
|
|
175
195
|
* @param {string} arg0
|
|
176
196
|
*/
|
|
177
197
|
set decision(arg0) {
|
|
178
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
198
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
179
199
|
const len0 = WASM_VECTOR_LEN;
|
|
180
200
|
wasm.__wbg_set_approvaltokenclaims_decision(this.__wbg_ptr, ptr0, len0);
|
|
181
201
|
}
|
|
@@ -184,21 +204,21 @@ export class ApprovalTokenClaims {
|
|
|
184
204
|
* @param {bigint} arg0
|
|
185
205
|
*/
|
|
186
206
|
set expiry_unix_secs(arg0) {
|
|
187
|
-
wasm.__wbg_set_approvaltokenclaims_expiry_unix_secs(this.__wbg_ptr, arg0);
|
|
207
|
+
wasm.__wbg_set_approvaltokenclaims_expiry_unix_secs(this.__wbg_ptr, addHeapObject(arg0));
|
|
188
208
|
}
|
|
189
209
|
/**
|
|
190
210
|
* The 32-byte random nonce as a `Uint8Array`.
|
|
191
211
|
* @param {Uint8Array} arg0
|
|
192
212
|
*/
|
|
193
213
|
set nonce(arg0) {
|
|
194
|
-
wasm.__wbg_set_approvaltokenclaims_nonce(this.__wbg_ptr, arg0);
|
|
214
|
+
wasm.__wbg_set_approvaltokenclaims_nonce(this.__wbg_ptr, addHeapObject(arg0));
|
|
195
215
|
}
|
|
196
216
|
/**
|
|
197
217
|
* The scope string encoded in the token.
|
|
198
218
|
* @param {string} arg0
|
|
199
219
|
*/
|
|
200
220
|
set scope(arg0) {
|
|
201
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
221
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
202
222
|
const len0 = WASM_VECTOR_LEN;
|
|
203
223
|
wasm.__wbg_set_approvaltokenclaims_scope(this.__wbg_ptr, ptr0, len0);
|
|
204
224
|
}
|
|
@@ -230,26 +250,40 @@ export class ChainResult {
|
|
|
230
250
|
* @returns {string | undefined}
|
|
231
251
|
*/
|
|
232
252
|
get detail() {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
253
|
+
try {
|
|
254
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
255
|
+
wasm.__wbg_get_chainresult_detail(retptr, this.__wbg_ptr);
|
|
256
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
257
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
258
|
+
let v1;
|
|
259
|
+
if (r0 !== 0) {
|
|
260
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
261
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
262
|
+
}
|
|
263
|
+
return v1;
|
|
264
|
+
} finally {
|
|
265
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
266
|
}
|
|
239
|
-
return v1;
|
|
240
267
|
}
|
|
241
268
|
/**
|
|
242
269
|
* Error kind string. Only set when `ok == false`.
|
|
243
270
|
* @returns {string | undefined}
|
|
244
271
|
*/
|
|
245
272
|
get error() {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
273
|
+
try {
|
|
274
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
275
|
+
wasm.__wbg_get_chainresult_error(retptr, this.__wbg_ptr);
|
|
276
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
277
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
278
|
+
let v1;
|
|
279
|
+
if (r0 !== 0) {
|
|
280
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
281
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
282
|
+
}
|
|
283
|
+
return v1;
|
|
284
|
+
} finally {
|
|
285
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
251
286
|
}
|
|
252
|
-
return v1;
|
|
253
287
|
}
|
|
254
288
|
/**
|
|
255
289
|
* Number of receipts verified. Only set when `ok == true`.
|
|
@@ -280,7 +314,7 @@ export class ChainResult {
|
|
|
280
314
|
* @param {string | null} [arg0]
|
|
281
315
|
*/
|
|
282
316
|
set detail(arg0) {
|
|
283
|
-
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.
|
|
317
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
284
318
|
var len0 = WASM_VECTOR_LEN;
|
|
285
319
|
wasm.__wbg_set_chainresult_detail(this.__wbg_ptr, ptr0, len0);
|
|
286
320
|
}
|
|
@@ -289,7 +323,7 @@ export class ChainResult {
|
|
|
289
323
|
* @param {string | null} [arg0]
|
|
290
324
|
*/
|
|
291
325
|
set error(arg0) {
|
|
292
|
-
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.
|
|
326
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
293
327
|
var len0 = WASM_VECTOR_LEN;
|
|
294
328
|
wasm.__wbg_set_chainresult_error(this.__wbg_ptr, ptr0, len0);
|
|
295
329
|
}
|
|
@@ -317,6 +351,497 @@ export class ChainResult {
|
|
|
317
351
|
}
|
|
318
352
|
if (Symbol.dispose) ChainResult.prototype[Symbol.dispose] = ChainResult.prototype.free;
|
|
319
353
|
|
|
354
|
+
/**
|
|
355
|
+
* The kind-tagged verdict of [`verify_commitment_wasm`]. `verdict` is one of
|
|
356
|
+
* `"Valid"`, `"InvalidSignature"`, `"FingerprintMismatch"`, `"WrongAlgorithm"`,
|
|
357
|
+
* `"Malformed"`; a recipient accepts the commitment ONLY on `"Valid"`.
|
|
358
|
+
* `signer_fpr` carries the recomputed `blake3(pubkey)` fingerprint (only
|
|
359
|
+
* meaningful on `"Valid"`).
|
|
360
|
+
*/
|
|
361
|
+
export class CommitmentVerdict {
|
|
362
|
+
static __wrap(ptr) {
|
|
363
|
+
const obj = Object.create(CommitmentVerdict.prototype);
|
|
364
|
+
obj.__wbg_ptr = ptr;
|
|
365
|
+
CommitmentVerdictFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
366
|
+
return obj;
|
|
367
|
+
}
|
|
368
|
+
__destroy_into_raw() {
|
|
369
|
+
const ptr = this.__wbg_ptr;
|
|
370
|
+
this.__wbg_ptr = 0;
|
|
371
|
+
CommitmentVerdictFinalization.unregister(this);
|
|
372
|
+
return ptr;
|
|
373
|
+
}
|
|
374
|
+
free() {
|
|
375
|
+
const ptr = this.__destroy_into_raw();
|
|
376
|
+
wasm.__wbg_commitmentverdict_free(ptr, 0);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The recomputed `blake3(pubkey)` fingerprint (only set on `"Valid"`).
|
|
380
|
+
* @returns {string}
|
|
381
|
+
*/
|
|
382
|
+
get signer_fpr() {
|
|
383
|
+
let deferred1_0;
|
|
384
|
+
let deferred1_1;
|
|
385
|
+
try {
|
|
386
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
387
|
+
wasm.__wbg_get_commitmentverdict_signer_fpr(retptr, this.__wbg_ptr);
|
|
388
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
389
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
390
|
+
deferred1_0 = r0;
|
|
391
|
+
deferred1_1 = r1;
|
|
392
|
+
return getStringFromWasm0(r0, r1);
|
|
393
|
+
} finally {
|
|
394
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
395
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The verdict tag.
|
|
400
|
+
* @returns {string}
|
|
401
|
+
*/
|
|
402
|
+
get verdict() {
|
|
403
|
+
let deferred1_0;
|
|
404
|
+
let deferred1_1;
|
|
405
|
+
try {
|
|
406
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
407
|
+
wasm.__wbg_get_commitmentverdict_verdict(retptr, this.__wbg_ptr);
|
|
408
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
409
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
410
|
+
deferred1_0 = r0;
|
|
411
|
+
deferred1_1 = r1;
|
|
412
|
+
return getStringFromWasm0(r0, r1);
|
|
413
|
+
} finally {
|
|
414
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
415
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The recomputed `blake3(pubkey)` fingerprint (only set on `"Valid"`).
|
|
420
|
+
* @param {string} arg0
|
|
421
|
+
*/
|
|
422
|
+
set signer_fpr(arg0) {
|
|
423
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
424
|
+
const len0 = WASM_VECTOR_LEN;
|
|
425
|
+
wasm.__wbg_set_commitmentverdict_signer_fpr(this.__wbg_ptr, ptr0, len0);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* The verdict tag.
|
|
429
|
+
* @param {string} arg0
|
|
430
|
+
*/
|
|
431
|
+
set verdict(arg0) {
|
|
432
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
433
|
+
const len0 = WASM_VECTOR_LEN;
|
|
434
|
+
wasm.__wbg_set_commitmentverdict_verdict(this.__wbg_ptr, ptr0, len0);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (Symbol.dispose) CommitmentVerdict.prototype[Symbol.dispose] = CommitmentVerdict.prototype.free;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The base verdict + the rendered signed metrics + the offline-recomputed cost.
|
|
441
|
+
*
|
|
442
|
+
* `verdict` / `trust_level` are exactly what [`verify_action_receipt_wasm`]
|
|
443
|
+
* returns. The metric fields are the SIGNED values (the closed `status` /
|
|
444
|
+
* `token_source` enums rendered to their wire snake_case strings). `cost_display`
|
|
445
|
+
* / `recomputed_cost_micros` are RECOMPUTED from the rate card the caller passed
|
|
446
|
+
* in — `priced == false` (and both `None`) when that card does not price the
|
|
447
|
+
* model; never a guessed figure. `card_id_matches` tells the reader whether the
|
|
448
|
+
* card handed in is the one the receipt actually named.
|
|
449
|
+
*/
|
|
450
|
+
export class MetricsVerdict {
|
|
451
|
+
static __wrap(ptr) {
|
|
452
|
+
const obj = Object.create(MetricsVerdict.prototype);
|
|
453
|
+
obj.__wbg_ptr = ptr;
|
|
454
|
+
MetricsVerdictFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
455
|
+
return obj;
|
|
456
|
+
}
|
|
457
|
+
__destroy_into_raw() {
|
|
458
|
+
const ptr = this.__wbg_ptr;
|
|
459
|
+
this.__wbg_ptr = 0;
|
|
460
|
+
MetricsVerdictFinalization.unregister(this);
|
|
461
|
+
return ptr;
|
|
462
|
+
}
|
|
463
|
+
free() {
|
|
464
|
+
const ptr = this.__destroy_into_raw();
|
|
465
|
+
wasm.__wbg_metricsverdict_free(ptr, 0);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Request bytes sent, when the transport exposed it.
|
|
469
|
+
* @returns {number | undefined}
|
|
470
|
+
*/
|
|
471
|
+
get bytes_in() {
|
|
472
|
+
const ret = wasm.__wbg_get_metricsverdict_bytes_in(this.__wbg_ptr);
|
|
473
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Response bytes received, when the transport exposed it.
|
|
477
|
+
* @returns {number | undefined}
|
|
478
|
+
*/
|
|
479
|
+
get bytes_out() {
|
|
480
|
+
const ret = wasm.__wbg_get_metricsverdict_bytes_out(this.__wbg_ptr);
|
|
481
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Whether the passed-in card is the one the receipt named.
|
|
485
|
+
* @returns {boolean}
|
|
486
|
+
*/
|
|
487
|
+
get card_id_matches() {
|
|
488
|
+
const ret = wasm.__wbg_get_metricsverdict_card_id_matches(this.__wbg_ptr);
|
|
489
|
+
return ret !== 0;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Recomputed cost as a 6-decimal display string; `None` when not priced.
|
|
493
|
+
* @returns {string | undefined}
|
|
494
|
+
*/
|
|
495
|
+
get cost_display() {
|
|
496
|
+
try {
|
|
497
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
498
|
+
wasm.__wbg_get_metricsverdict_cost_display(retptr, this.__wbg_ptr);
|
|
499
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
500
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
501
|
+
let v1;
|
|
502
|
+
if (r0 !== 0) {
|
|
503
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
504
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
505
|
+
}
|
|
506
|
+
return v1;
|
|
507
|
+
} finally {
|
|
508
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Wall-clock duration in whole milliseconds.
|
|
513
|
+
* @returns {number | undefined}
|
|
514
|
+
*/
|
|
515
|
+
get duration_ms() {
|
|
516
|
+
const ret = wasm.__wbg_get_metricsverdict_duration_ms(this.__wbg_ptr);
|
|
517
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Whether the receipt carried a signed `metrics` block.
|
|
521
|
+
* @returns {boolean}
|
|
522
|
+
*/
|
|
523
|
+
get has_metrics() {
|
|
524
|
+
const ret = wasm.__wbg_get_metricsverdict_has_metrics(this.__wbg_ptr);
|
|
525
|
+
return ret !== 0;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The `provider/model` key derived from the signed `action.fields`.
|
|
529
|
+
* @returns {string | undefined}
|
|
530
|
+
*/
|
|
531
|
+
get model_key() {
|
|
532
|
+
try {
|
|
533
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
534
|
+
wasm.__wbg_get_metricsverdict_model_key(retptr, this.__wbg_ptr);
|
|
535
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
536
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
537
|
+
let v1;
|
|
538
|
+
if (r0 !== 0) {
|
|
539
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
540
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
541
|
+
}
|
|
542
|
+
return v1;
|
|
543
|
+
} finally {
|
|
544
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* `true` iff the model is priced by the passed-in card.
|
|
549
|
+
* @returns {boolean}
|
|
550
|
+
*/
|
|
551
|
+
get priced() {
|
|
552
|
+
const ret = wasm.__wbg_get_metricsverdict_priced(this.__wbg_ptr);
|
|
553
|
+
return ret !== 0;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* The rate-card id AS NAMED in the signed receipt.
|
|
557
|
+
* @returns {string | undefined}
|
|
558
|
+
*/
|
|
559
|
+
get rate_card_id() {
|
|
560
|
+
try {
|
|
561
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
562
|
+
wasm.__wbg_get_metricsverdict_rate_card_id(retptr, this.__wbg_ptr);
|
|
563
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
564
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
565
|
+
let v1;
|
|
566
|
+
if (r0 !== 0) {
|
|
567
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
568
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
569
|
+
}
|
|
570
|
+
return v1;
|
|
571
|
+
} finally {
|
|
572
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Recomputed cost in micro-USD (`BigInt`); `None` when not priced.
|
|
577
|
+
* @returns {bigint | undefined}
|
|
578
|
+
*/
|
|
579
|
+
get recomputed_cost_micros() {
|
|
580
|
+
try {
|
|
581
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
582
|
+
wasm.__wbg_get_metricsverdict_recomputed_cost_micros(retptr, this.__wbg_ptr);
|
|
583
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
584
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
585
|
+
return r0 === 0 ? undefined : BigInt.asUintN(64, r2);
|
|
586
|
+
} finally {
|
|
587
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Transport-level retries before this outcome.
|
|
592
|
+
* @returns {number | undefined}
|
|
593
|
+
*/
|
|
594
|
+
get retries() {
|
|
595
|
+
const ret = wasm.__wbg_get_metricsverdict_retries(this.__wbg_ptr);
|
|
596
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Transport status code, when one applied.
|
|
600
|
+
* @returns {number | undefined}
|
|
601
|
+
*/
|
|
602
|
+
get status_code() {
|
|
603
|
+
const ret = wasm.__wbg_get_metricsverdict_status_code(this.__wbg_ptr);
|
|
604
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Execution-outcome class, wire snake_case (`"ok"`, `"server_error"`, …).
|
|
608
|
+
* @returns {string | undefined}
|
|
609
|
+
*/
|
|
610
|
+
get status() {
|
|
611
|
+
try {
|
|
612
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
613
|
+
wasm.__wbg_get_metricsverdict_status(retptr, this.__wbg_ptr);
|
|
614
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
615
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
616
|
+
let v1;
|
|
617
|
+
if (r0 !== 0) {
|
|
618
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
619
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
620
|
+
}
|
|
621
|
+
return v1;
|
|
622
|
+
} finally {
|
|
623
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Token-count source, wire snake_case (`"provider_reported"`/`"estimated"`).
|
|
628
|
+
* @returns {string | undefined}
|
|
629
|
+
*/
|
|
630
|
+
get token_source() {
|
|
631
|
+
try {
|
|
632
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
633
|
+
wasm.__wbg_get_metricsverdict_token_source(retptr, this.__wbg_ptr);
|
|
634
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
635
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
636
|
+
let v1;
|
|
637
|
+
if (r0 !== 0) {
|
|
638
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
639
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
640
|
+
}
|
|
641
|
+
return v1;
|
|
642
|
+
} finally {
|
|
643
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Provider-reported (or estimated) input tokens.
|
|
648
|
+
* @returns {number | undefined}
|
|
649
|
+
*/
|
|
650
|
+
get tokens_in() {
|
|
651
|
+
const ret = wasm.__wbg_get_metricsverdict_tokens_in(this.__wbg_ptr);
|
|
652
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Provider-reported (or estimated) output tokens.
|
|
656
|
+
* @returns {number | undefined}
|
|
657
|
+
*/
|
|
658
|
+
get tokens_out() {
|
|
659
|
+
const ret = wasm.__wbg_get_metricsverdict_tokens_out(this.__wbg_ptr);
|
|
660
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* The re-derived trust level (`"L0"`/`"L1"`); `""` unless `verdict == "Valid"`.
|
|
664
|
+
* @returns {string}
|
|
665
|
+
*/
|
|
666
|
+
get trust_level() {
|
|
667
|
+
let deferred1_0;
|
|
668
|
+
let deferred1_1;
|
|
669
|
+
try {
|
|
670
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
671
|
+
wasm.__wbg_get_metricsverdict_trust_level(retptr, this.__wbg_ptr);
|
|
672
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
673
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
674
|
+
deferred1_0 = r0;
|
|
675
|
+
deferred1_1 = r1;
|
|
676
|
+
return getStringFromWasm0(r0, r1);
|
|
677
|
+
} finally {
|
|
678
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
679
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* The base `ActionOutcome` verdict tag (`"Valid"`, `"HashMismatch"`, …).
|
|
684
|
+
* @returns {string}
|
|
685
|
+
*/
|
|
686
|
+
get verdict() {
|
|
687
|
+
let deferred1_0;
|
|
688
|
+
let deferred1_1;
|
|
689
|
+
try {
|
|
690
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
691
|
+
wasm.__wbg_get_metricsverdict_verdict(retptr, this.__wbg_ptr);
|
|
692
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
693
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
694
|
+
deferred1_0 = r0;
|
|
695
|
+
deferred1_1 = r1;
|
|
696
|
+
return getStringFromWasm0(r0, r1);
|
|
697
|
+
} finally {
|
|
698
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
699
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Request bytes sent, when the transport exposed it.
|
|
704
|
+
* @param {number | null} [arg0]
|
|
705
|
+
*/
|
|
706
|
+
set bytes_in(arg0) {
|
|
707
|
+
wasm.__wbg_set_metricsverdict_bytes_in(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Response bytes received, when the transport exposed it.
|
|
711
|
+
* @param {number | null} [arg0]
|
|
712
|
+
*/
|
|
713
|
+
set bytes_out(arg0) {
|
|
714
|
+
wasm.__wbg_set_metricsverdict_bytes_out(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Whether the passed-in card is the one the receipt named.
|
|
718
|
+
* @param {boolean} arg0
|
|
719
|
+
*/
|
|
720
|
+
set card_id_matches(arg0) {
|
|
721
|
+
wasm.__wbg_set_metricsverdict_card_id_matches(this.__wbg_ptr, arg0);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Recomputed cost as a 6-decimal display string; `None` when not priced.
|
|
725
|
+
* @param {string | null} [arg0]
|
|
726
|
+
*/
|
|
727
|
+
set cost_display(arg0) {
|
|
728
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
729
|
+
var len0 = WASM_VECTOR_LEN;
|
|
730
|
+
wasm.__wbg_set_metricsverdict_cost_display(this.__wbg_ptr, ptr0, len0);
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Wall-clock duration in whole milliseconds.
|
|
734
|
+
* @param {number | null} [arg0]
|
|
735
|
+
*/
|
|
736
|
+
set duration_ms(arg0) {
|
|
737
|
+
wasm.__wbg_set_metricsverdict_duration_ms(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Whether the receipt carried a signed `metrics` block.
|
|
741
|
+
* @param {boolean} arg0
|
|
742
|
+
*/
|
|
743
|
+
set has_metrics(arg0) {
|
|
744
|
+
wasm.__wbg_set_metricsverdict_has_metrics(this.__wbg_ptr, arg0);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* The `provider/model` key derived from the signed `action.fields`.
|
|
748
|
+
* @param {string | null} [arg0]
|
|
749
|
+
*/
|
|
750
|
+
set model_key(arg0) {
|
|
751
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
752
|
+
var len0 = WASM_VECTOR_LEN;
|
|
753
|
+
wasm.__wbg_set_metricsverdict_model_key(this.__wbg_ptr, ptr0, len0);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* `true` iff the model is priced by the passed-in card.
|
|
757
|
+
* @param {boolean} arg0
|
|
758
|
+
*/
|
|
759
|
+
set priced(arg0) {
|
|
760
|
+
wasm.__wbg_set_metricsverdict_priced(this.__wbg_ptr, arg0);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* The rate-card id AS NAMED in the signed receipt.
|
|
764
|
+
* @param {string | null} [arg0]
|
|
765
|
+
*/
|
|
766
|
+
set rate_card_id(arg0) {
|
|
767
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
768
|
+
var len0 = WASM_VECTOR_LEN;
|
|
769
|
+
wasm.__wbg_set_metricsverdict_rate_card_id(this.__wbg_ptr, ptr0, len0);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Recomputed cost in micro-USD (`BigInt`); `None` when not priced.
|
|
773
|
+
* @param {bigint | null} [arg0]
|
|
774
|
+
*/
|
|
775
|
+
set recomputed_cost_micros(arg0) {
|
|
776
|
+
wasm.__wbg_set_metricsverdict_recomputed_cost_micros(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? BigInt(0) : arg0);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Transport-level retries before this outcome.
|
|
780
|
+
* @param {number | null} [arg0]
|
|
781
|
+
*/
|
|
782
|
+
set retries(arg0) {
|
|
783
|
+
wasm.__wbg_set_metricsverdict_retries(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Transport status code, when one applied.
|
|
787
|
+
* @param {number | null} [arg0]
|
|
788
|
+
*/
|
|
789
|
+
set status_code(arg0) {
|
|
790
|
+
wasm.__wbg_set_metricsverdict_status_code(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Execution-outcome class, wire snake_case (`"ok"`, `"server_error"`, …).
|
|
794
|
+
* @param {string | null} [arg0]
|
|
795
|
+
*/
|
|
796
|
+
set status(arg0) {
|
|
797
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
798
|
+
var len0 = WASM_VECTOR_LEN;
|
|
799
|
+
wasm.__wbg_set_metricsverdict_status(this.__wbg_ptr, ptr0, len0);
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Token-count source, wire snake_case (`"provider_reported"`/`"estimated"`).
|
|
803
|
+
* @param {string | null} [arg0]
|
|
804
|
+
*/
|
|
805
|
+
set token_source(arg0) {
|
|
806
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
807
|
+
var len0 = WASM_VECTOR_LEN;
|
|
808
|
+
wasm.__wbg_set_metricsverdict_token_source(this.__wbg_ptr, ptr0, len0);
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Provider-reported (or estimated) input tokens.
|
|
812
|
+
* @param {number | null} [arg0]
|
|
813
|
+
*/
|
|
814
|
+
set tokens_in(arg0) {
|
|
815
|
+
wasm.__wbg_set_metricsverdict_tokens_in(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Provider-reported (or estimated) output tokens.
|
|
819
|
+
* @param {number | null} [arg0]
|
|
820
|
+
*/
|
|
821
|
+
set tokens_out(arg0) {
|
|
822
|
+
wasm.__wbg_set_metricsverdict_tokens_out(this.__wbg_ptr, isLikeNone(arg0) ? Number.MAX_SAFE_INTEGER : (arg0) >>> 0);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* The re-derived trust level (`"L0"`/`"L1"`); `""` unless `verdict == "Valid"`.
|
|
826
|
+
* @param {string} arg0
|
|
827
|
+
*/
|
|
828
|
+
set trust_level(arg0) {
|
|
829
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
830
|
+
const len0 = WASM_VECTOR_LEN;
|
|
831
|
+
wasm.__wbg_set_metricsverdict_trust_level(this.__wbg_ptr, ptr0, len0);
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* The base `ActionOutcome` verdict tag (`"Valid"`, `"HashMismatch"`, …).
|
|
835
|
+
* @param {string} arg0
|
|
836
|
+
*/
|
|
837
|
+
set verdict(arg0) {
|
|
838
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
839
|
+
const len0 = WASM_VECTOR_LEN;
|
|
840
|
+
wasm.__wbg_set_metricsverdict_verdict(this.__wbg_ptr, ptr0, len0);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
if (Symbol.dispose) MetricsVerdict.prototype[Symbol.dispose] = MetricsVerdict.prototype.free;
|
|
844
|
+
|
|
320
845
|
/**
|
|
321
846
|
* The verified, decoded result of a delegation envelope.
|
|
322
847
|
*/
|
|
@@ -343,7 +868,7 @@ export class VerifiedDelegation {
|
|
|
343
868
|
*/
|
|
344
869
|
get authorized_key() {
|
|
345
870
|
const ret = wasm.__wbg_get_verifieddelegation_authorized_key(this.__wbg_ptr);
|
|
346
|
-
return ret;
|
|
871
|
+
return takeObject(ret);
|
|
347
872
|
}
|
|
348
873
|
/**
|
|
349
874
|
* The envelope's expiry as Unix seconds (`BigInt`).
|
|
@@ -351,7 +876,7 @@ export class VerifiedDelegation {
|
|
|
351
876
|
*/
|
|
352
877
|
get expiry_unix_secs() {
|
|
353
878
|
const ret = wasm.__wbg_get_verifieddelegation_expiry_unix_secs(this.__wbg_ptr);
|
|
354
|
-
return ret;
|
|
879
|
+
return takeObject(ret);
|
|
355
880
|
}
|
|
356
881
|
/**
|
|
357
882
|
* The envelope's not_before as Unix seconds (`BigInt`).
|
|
@@ -359,7 +884,7 @@ export class VerifiedDelegation {
|
|
|
359
884
|
*/
|
|
360
885
|
get not_before_unix_secs() {
|
|
361
886
|
const ret = wasm.__wbg_get_verifieddelegation_not_before_unix_secs(this.__wbg_ptr);
|
|
362
|
-
return ret;
|
|
887
|
+
return takeObject(ret);
|
|
363
888
|
}
|
|
364
889
|
/**
|
|
365
890
|
* The scope the delegated authority was bound to.
|
|
@@ -369,12 +894,16 @@ export class VerifiedDelegation {
|
|
|
369
894
|
let deferred1_0;
|
|
370
895
|
let deferred1_1;
|
|
371
896
|
try {
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
897
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
898
|
+
wasm.__wbg_get_verifieddelegation_scope(retptr, this.__wbg_ptr);
|
|
899
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
900
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
901
|
+
deferred1_0 = r0;
|
|
902
|
+
deferred1_1 = r1;
|
|
903
|
+
return getStringFromWasm0(r0, r1);
|
|
376
904
|
} finally {
|
|
377
|
-
wasm.
|
|
905
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
906
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
378
907
|
}
|
|
379
908
|
}
|
|
380
909
|
/**
|
|
@@ -385,12 +914,16 @@ export class VerifiedDelegation {
|
|
|
385
914
|
let deferred1_0;
|
|
386
915
|
let deferred1_1;
|
|
387
916
|
try {
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
917
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
918
|
+
wasm.__wbg_get_verifieddelegation_sub(retptr, this.__wbg_ptr);
|
|
919
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
920
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
921
|
+
deferred1_0 = r0;
|
|
922
|
+
deferred1_1 = r1;
|
|
923
|
+
return getStringFromWasm0(r0, r1);
|
|
392
924
|
} finally {
|
|
393
|
-
wasm.
|
|
925
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
926
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
394
927
|
}
|
|
395
928
|
}
|
|
396
929
|
/**
|
|
@@ -398,28 +931,28 @@ export class VerifiedDelegation {
|
|
|
398
931
|
* @param {Uint8Array} arg0
|
|
399
932
|
*/
|
|
400
933
|
set authorized_key(arg0) {
|
|
401
|
-
wasm.__wbg_set_verifieddelegation_authorized_key(this.__wbg_ptr, arg0);
|
|
934
|
+
wasm.__wbg_set_verifieddelegation_authorized_key(this.__wbg_ptr, addHeapObject(arg0));
|
|
402
935
|
}
|
|
403
936
|
/**
|
|
404
937
|
* The envelope's expiry as Unix seconds (`BigInt`).
|
|
405
938
|
* @param {bigint} arg0
|
|
406
939
|
*/
|
|
407
940
|
set expiry_unix_secs(arg0) {
|
|
408
|
-
wasm.__wbg_set_verifieddelegation_expiry_unix_secs(this.__wbg_ptr, arg0);
|
|
941
|
+
wasm.__wbg_set_verifieddelegation_expiry_unix_secs(this.__wbg_ptr, addHeapObject(arg0));
|
|
409
942
|
}
|
|
410
943
|
/**
|
|
411
944
|
* The envelope's not_before as Unix seconds (`BigInt`).
|
|
412
945
|
* @param {bigint} arg0
|
|
413
946
|
*/
|
|
414
947
|
set not_before_unix_secs(arg0) {
|
|
415
|
-
wasm.__wbg_set_verifieddelegation_not_before_unix_secs(this.__wbg_ptr, arg0);
|
|
948
|
+
wasm.__wbg_set_verifieddelegation_not_before_unix_secs(this.__wbg_ptr, addHeapObject(arg0));
|
|
416
949
|
}
|
|
417
950
|
/**
|
|
418
951
|
* The scope the delegated authority was bound to.
|
|
419
952
|
* @param {string} arg0
|
|
420
953
|
*/
|
|
421
954
|
set scope(arg0) {
|
|
422
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
955
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
423
956
|
const len0 = WASM_VECTOR_LEN;
|
|
424
957
|
wasm.__wbg_set_verifieddelegation_scope(this.__wbg_ptr, ptr0, len0);
|
|
425
958
|
}
|
|
@@ -428,7 +961,7 @@ export class VerifiedDelegation {
|
|
|
428
961
|
* @param {string} arg0
|
|
429
962
|
*/
|
|
430
963
|
set sub(arg0) {
|
|
431
|
-
const ptr0 = passStringToWasm0(arg0, wasm.
|
|
964
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
432
965
|
const len0 = WASM_VECTOR_LEN;
|
|
433
966
|
wasm.__wbg_set_verifieddelegation_sub(this.__wbg_ptr, ptr0, len0);
|
|
434
967
|
}
|
|
@@ -443,13 +976,21 @@ if (Symbol.dispose) VerifiedDelegation.prototype[Symbol.dispose] = VerifiedDeleg
|
|
|
443
976
|
* @returns {Uint8Array}
|
|
444
977
|
*/
|
|
445
978
|
export function actionCanonicalBytes(content_json) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
979
|
+
try {
|
|
980
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
981
|
+
const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
982
|
+
const len0 = WASM_VECTOR_LEN;
|
|
983
|
+
wasm.actionCanonicalBytes(retptr, ptr0, len0);
|
|
984
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
985
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
986
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
987
|
+
if (r2) {
|
|
988
|
+
throw takeObject(r1);
|
|
989
|
+
}
|
|
990
|
+
return takeObject(r0);
|
|
991
|
+
} finally {
|
|
992
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
451
993
|
}
|
|
452
|
-
return takeFromExternrefTable0(ret[0]);
|
|
453
994
|
}
|
|
454
995
|
|
|
455
996
|
/**
|
|
@@ -462,20 +1003,126 @@ export function anchoredContentHash(content_json) {
|
|
|
462
1003
|
let deferred3_0;
|
|
463
1004
|
let deferred3_1;
|
|
464
1005
|
try {
|
|
465
|
-
const
|
|
1006
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1007
|
+
const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
466
1008
|
const len0 = WASM_VECTOR_LEN;
|
|
467
|
-
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
|
|
1009
|
+
wasm.anchoredContentHash(retptr, ptr0, len0);
|
|
1010
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1011
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1012
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1013
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1014
|
+
var ptr2 = r0;
|
|
1015
|
+
var len2 = r1;
|
|
1016
|
+
if (r3) {
|
|
471
1017
|
ptr2 = 0; len2 = 0;
|
|
472
|
-
throw
|
|
1018
|
+
throw takeObject(r2);
|
|
473
1019
|
}
|
|
474
1020
|
deferred3_0 = ptr2;
|
|
475
1021
|
deferred3_1 = len2;
|
|
476
1022
|
return getStringFromWasm0(ptr2, len2);
|
|
477
1023
|
} finally {
|
|
478
|
-
wasm.
|
|
1024
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1025
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Assemble the on-the-wire approval-token frame from the detached signature the
|
|
1031
|
+
* in-browser approver key produced over [`approval_token_payload_wasm`]. Pure
|
|
1032
|
+
* assemble, no key. The base64 of these bytes is the bearer `token_b64`.
|
|
1033
|
+
*
|
|
1034
|
+
* Byte order (see [`heso_action::domain::approval_token_frame`], the ONE source —
|
|
1035
|
+
* the kernel verifier parses EXACTLY this and rejects trailing bytes):
|
|
1036
|
+
* `nonce(32) ++ expiry(BE8) ++ decision_tag(1) ++ scope_len(BE4) ++ scope
|
|
1037
|
+
* ++ signature(64) ++ pubkey(32)`
|
|
1038
|
+
*
|
|
1039
|
+
* `nonce` — 32 raw bytes (Uint8Array); MUST equal the nonce signed over.
|
|
1040
|
+
* `expiryUnixSecs` — token expiry as BigInt Unix seconds.
|
|
1041
|
+
* `decision` — `"approved"` or `"rejected"`.
|
|
1042
|
+
* `scope` — the UTF-8 scope string.
|
|
1043
|
+
* `signature` — 64 raw Ed25519 signature bytes (Uint8Array).
|
|
1044
|
+
* `pubkey` — 32 raw Ed25519 public-key bytes (Uint8Array).
|
|
1045
|
+
* @param {Uint8Array} nonce
|
|
1046
|
+
* @param {bigint} expiry_unix_secs
|
|
1047
|
+
* @param {string} decision
|
|
1048
|
+
* @param {string} scope
|
|
1049
|
+
* @param {Uint8Array} signature
|
|
1050
|
+
* @param {Uint8Array} pubkey
|
|
1051
|
+
* @returns {Uint8Array}
|
|
1052
|
+
*/
|
|
1053
|
+
export function approvalTokenFrame(nonce, expiry_unix_secs, decision, scope, signature, pubkey) {
|
|
1054
|
+
try {
|
|
1055
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1056
|
+
const ptr0 = passArray8ToWasm0(nonce, wasm.__wbindgen_export);
|
|
1057
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1058
|
+
const ptr1 = passStringToWasm0(decision, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1059
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1060
|
+
const ptr2 = passStringToWasm0(scope, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1061
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1062
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_export);
|
|
1063
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1064
|
+
const ptr4 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
|
|
1065
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1066
|
+
wasm.approvalTokenFrame(retptr, ptr0, len0, addHeapObject(expiry_unix_secs), ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
1067
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1068
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1069
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1070
|
+
if (r2) {
|
|
1071
|
+
throw takeObject(r1);
|
|
1072
|
+
}
|
|
1073
|
+
return takeObject(r0);
|
|
1074
|
+
} finally {
|
|
1075
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Return the EXACT bytes the approver's Ed25519 key must sign for an approval
|
|
1081
|
+
* token (the Option-C in-browser minter signs THESE, never any hand-rolled
|
|
1082
|
+
* bytes). Mirrors [`l1_cosign_payload_wasm`]: pure assemble, no OsRng, no key —
|
|
1083
|
+
* the browser holds the key, this only produces the payload a detached signer
|
|
1084
|
+
* covers.
|
|
1085
|
+
*
|
|
1086
|
+
* Byte order (see [`heso_action::domain::approval_token_signed_payload`], the ONE
|
|
1087
|
+
* source — the kernel verifier recomputes the identical bytes):
|
|
1088
|
+
* `APPROVAL_TOKEN_SIGNING_DOMAIN ++ nonce(32) ++ expiry(BE8) ++ decision_tag(1)
|
|
1089
|
+
* ++ scope_len(BE4) ++ scope ++ action_canonical_bytes`
|
|
1090
|
+
*
|
|
1091
|
+
* `contentJson` — the `ActionContent` JSON; canonicalized through the SAME
|
|
1092
|
+
* RFC-8785 path as [`action_canonical_bytes_wasm`] (the
|
|
1093
|
+
* browser MUST NOT hand-roll JCS).
|
|
1094
|
+
* `nonce` — 32 raw replay-prevention bytes (Uint8Array).
|
|
1095
|
+
* `expiryUnixSecs` — token expiry as BigInt Unix seconds.
|
|
1096
|
+
* `decision` — `"approved"` or `"rejected"` (the SEC-02 decision binding).
|
|
1097
|
+
* `scope` — the UTF-8 scope string.
|
|
1098
|
+
* @param {string} content_json
|
|
1099
|
+
* @param {Uint8Array} nonce
|
|
1100
|
+
* @param {bigint} expiry_unix_secs
|
|
1101
|
+
* @param {string} decision
|
|
1102
|
+
* @param {string} scope
|
|
1103
|
+
* @returns {Uint8Array}
|
|
1104
|
+
*/
|
|
1105
|
+
export function approvalTokenPayload(content_json, nonce, expiry_unix_secs, decision, scope) {
|
|
1106
|
+
try {
|
|
1107
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1108
|
+
const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1110
|
+
const ptr1 = passArray8ToWasm0(nonce, wasm.__wbindgen_export);
|
|
1111
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1112
|
+
const ptr2 = passStringToWasm0(decision, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1113
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1114
|
+
const ptr3 = passStringToWasm0(scope, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1115
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1116
|
+
wasm.approvalTokenPayload(retptr, ptr0, len0, ptr1, len1, addHeapObject(expiry_unix_secs), ptr2, len2, ptr3, len3);
|
|
1117
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1118
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1119
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1120
|
+
if (r2) {
|
|
1121
|
+
throw takeObject(r1);
|
|
1122
|
+
}
|
|
1123
|
+
return takeObject(r0);
|
|
1124
|
+
} finally {
|
|
1125
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
479
1126
|
}
|
|
480
1127
|
}
|
|
481
1128
|
|
|
@@ -490,22 +1137,91 @@ export function chainHashHex(prev_hex, action_hex) {
|
|
|
490
1137
|
let deferred4_0;
|
|
491
1138
|
let deferred4_1;
|
|
492
1139
|
try {
|
|
493
|
-
const
|
|
1140
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1141
|
+
const ptr0 = passStringToWasm0(prev_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
494
1142
|
const len0 = WASM_VECTOR_LEN;
|
|
495
|
-
const ptr1 = passStringToWasm0(action_hex, wasm.
|
|
1143
|
+
const ptr1 = passStringToWasm0(action_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
496
1144
|
const len1 = WASM_VECTOR_LEN;
|
|
497
|
-
|
|
498
|
-
var
|
|
499
|
-
var
|
|
500
|
-
|
|
1145
|
+
wasm.chainHashHex(retptr, ptr0, len0, ptr1, len1);
|
|
1146
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1147
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1148
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1149
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1150
|
+
var ptr3 = r0;
|
|
1151
|
+
var len3 = r1;
|
|
1152
|
+
if (r3) {
|
|
501
1153
|
ptr3 = 0; len3 = 0;
|
|
502
|
-
throw
|
|
1154
|
+
throw takeObject(r2);
|
|
503
1155
|
}
|
|
504
1156
|
deferred4_0 = ptr3;
|
|
505
1157
|
deferred4_1 = len3;
|
|
506
1158
|
return getStringFromWasm0(ptr3, len3);
|
|
507
1159
|
} finally {
|
|
508
|
-
wasm.
|
|
1160
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1161
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* PURE. Return the RFC-8785 (JCS) canonical bytes of a commitment envelope JSON
|
|
1167
|
+
* string — the exact bytes the detached operator signature is computed over
|
|
1168
|
+
* (after the `COMMITMENT_SIGNING_DOMAIN` prefix). Delegates to the single kernel
|
|
1169
|
+
* JCS impl; never re-canonicalizes. Throws `[MALFORMED]` if the JSON does not
|
|
1170
|
+
* parse as a `CommitmentEnvelope` and `[CANON]` if it cannot be canonicalized.
|
|
1171
|
+
* @param {string} envelope_json
|
|
1172
|
+
* @returns {Uint8Array}
|
|
1173
|
+
*/
|
|
1174
|
+
export function commitmentEnvelopeCanonicalBytes(envelope_json) {
|
|
1175
|
+
try {
|
|
1176
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1177
|
+
const ptr0 = passStringToWasm0(envelope_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1178
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1179
|
+
wasm.commitmentEnvelopeCanonicalBytes(retptr, ptr0, len0);
|
|
1180
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1181
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1182
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1183
|
+
if (r2) {
|
|
1184
|
+
throw takeObject(r1);
|
|
1185
|
+
}
|
|
1186
|
+
return takeObject(r0);
|
|
1187
|
+
} finally {
|
|
1188
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* The **commitment fingerprint** of an Ed25519 public key: `blake3(raw_pubkey)`,
|
|
1194
|
+
* the full 32-byte digest, lowercase 64-hex, NO prefix — the value the producer
|
|
1195
|
+
* puts in the wire `signer_fpr`. DISTINCT from the `heso:`-prefixed Grade-0
|
|
1196
|
+
* signer fingerprint. Throws `[MALFORMED]` if `pubkey_b64` is not base64 of
|
|
1197
|
+
* exactly 32 bytes.
|
|
1198
|
+
* @param {string} pubkey_b64
|
|
1199
|
+
* @returns {string}
|
|
1200
|
+
*/
|
|
1201
|
+
export function commitmentFingerprint(pubkey_b64) {
|
|
1202
|
+
let deferred3_0;
|
|
1203
|
+
let deferred3_1;
|
|
1204
|
+
try {
|
|
1205
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1206
|
+
const ptr0 = passStringToWasm0(pubkey_b64, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1208
|
+
wasm.commitmentFingerprint(retptr, ptr0, len0);
|
|
1209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1211
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1212
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1213
|
+
var ptr2 = r0;
|
|
1214
|
+
var len2 = r1;
|
|
1215
|
+
if (r3) {
|
|
1216
|
+
ptr2 = 0; len2 = 0;
|
|
1217
|
+
throw takeObject(r2);
|
|
1218
|
+
}
|
|
1219
|
+
deferred3_0 = ptr2;
|
|
1220
|
+
deferred3_1 = len2;
|
|
1221
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1222
|
+
} finally {
|
|
1223
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1224
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
509
1225
|
}
|
|
510
1226
|
}
|
|
511
1227
|
|
|
@@ -519,20 +1235,26 @@ export function contentHash(content_json) {
|
|
|
519
1235
|
let deferred3_0;
|
|
520
1236
|
let deferred3_1;
|
|
521
1237
|
try {
|
|
522
|
-
const
|
|
1238
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1239
|
+
const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
523
1240
|
const len0 = WASM_VECTOR_LEN;
|
|
524
|
-
|
|
525
|
-
var
|
|
526
|
-
var
|
|
527
|
-
|
|
1241
|
+
wasm.contentHash(retptr, ptr0, len0);
|
|
1242
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1243
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1244
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1245
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1246
|
+
var ptr2 = r0;
|
|
1247
|
+
var len2 = r1;
|
|
1248
|
+
if (r3) {
|
|
528
1249
|
ptr2 = 0; len2 = 0;
|
|
529
|
-
throw
|
|
1250
|
+
throw takeObject(r2);
|
|
530
1251
|
}
|
|
531
1252
|
deferred3_0 = ptr2;
|
|
532
1253
|
deferred3_1 = len2;
|
|
533
1254
|
return getStringFromWasm0(ptr2, len2);
|
|
534
1255
|
} finally {
|
|
535
|
-
wasm.
|
|
1256
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1257
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
536
1258
|
}
|
|
537
1259
|
}
|
|
538
1260
|
|
|
@@ -575,15 +1297,23 @@ export function contentHash(content_json) {
|
|
|
575
1297
|
* @returns {Uint8Array}
|
|
576
1298
|
*/
|
|
577
1299
|
export function l1CosignPayload(suspended_content_json, approver_record_json) {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
1300
|
+
try {
|
|
1301
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1302
|
+
const ptr0 = passStringToWasm0(suspended_content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1304
|
+
const ptr1 = passStringToWasm0(approver_record_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1305
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1306
|
+
wasm.l1CosignPayload(retptr, ptr0, len0, ptr1, len1);
|
|
1307
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1308
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1309
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1310
|
+
if (r2) {
|
|
1311
|
+
throw takeObject(r1);
|
|
1312
|
+
}
|
|
1313
|
+
return takeObject(r0);
|
|
1314
|
+
} finally {
|
|
1315
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
585
1316
|
}
|
|
586
|
-
return takeFromExternrefTable0(ret[0]);
|
|
587
1317
|
}
|
|
588
1318
|
|
|
589
1319
|
/**
|
|
@@ -594,11 +1324,52 @@ export function l1CosignPayload(suspended_content_json, approver_record_json) {
|
|
|
594
1324
|
* @param {string} toml_src
|
|
595
1325
|
*/
|
|
596
1326
|
export function parsePolicy(toml_src) {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
1327
|
+
try {
|
|
1328
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1329
|
+
const ptr0 = passStringToWasm0(toml_src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1331
|
+
wasm.parsePolicy(retptr, ptr0, len0);
|
|
1332
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1333
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1334
|
+
if (r1) {
|
|
1335
|
+
throw takeObject(r0);
|
|
1336
|
+
}
|
|
1337
|
+
} finally {
|
|
1338
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Parse a C2SP signed-note checkpoint and return its `{origin, size, root_hex,
|
|
1344
|
+
* text}` as a JSON string. Does NO signature verification — call
|
|
1345
|
+
* `verifyNoteAgainstKey` for that. Throws `[NOTE]` on a malformed note.
|
|
1346
|
+
* @param {string} note
|
|
1347
|
+
* @returns {string}
|
|
1348
|
+
*/
|
|
1349
|
+
export function parseSignedNote(note) {
|
|
1350
|
+
let deferred3_0;
|
|
1351
|
+
let deferred3_1;
|
|
1352
|
+
try {
|
|
1353
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1354
|
+
const ptr0 = passStringToWasm0(note, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1355
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1356
|
+
wasm.parseSignedNote(retptr, ptr0, len0);
|
|
1357
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1358
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1359
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1360
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1361
|
+
var ptr2 = r0;
|
|
1362
|
+
var len2 = r1;
|
|
1363
|
+
if (r3) {
|
|
1364
|
+
ptr2 = 0; len2 = 0;
|
|
1365
|
+
throw takeObject(r2);
|
|
1366
|
+
}
|
|
1367
|
+
deferred3_0 = ptr2;
|
|
1368
|
+
deferred3_1 = len2;
|
|
1369
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1370
|
+
} finally {
|
|
1371
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1372
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
602
1373
|
}
|
|
603
1374
|
}
|
|
604
1375
|
|
|
@@ -615,20 +1386,26 @@ export function policyRulesFromToml(toml_src) {
|
|
|
615
1386
|
let deferred3_0;
|
|
616
1387
|
let deferred3_1;
|
|
617
1388
|
try {
|
|
618
|
-
const
|
|
1389
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1390
|
+
const ptr0 = passStringToWasm0(toml_src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
619
1391
|
const len0 = WASM_VECTOR_LEN;
|
|
620
|
-
|
|
621
|
-
var
|
|
622
|
-
var
|
|
623
|
-
|
|
1392
|
+
wasm.policyRulesFromToml(retptr, ptr0, len0);
|
|
1393
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1394
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1395
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1396
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1397
|
+
var ptr2 = r0;
|
|
1398
|
+
var len2 = r1;
|
|
1399
|
+
if (r3) {
|
|
624
1400
|
ptr2 = 0; len2 = 0;
|
|
625
|
-
throw
|
|
1401
|
+
throw takeObject(r2);
|
|
626
1402
|
}
|
|
627
1403
|
deferred3_0 = ptr2;
|
|
628
1404
|
deferred3_1 = len2;
|
|
629
1405
|
return getStringFromWasm0(ptr2, len2);
|
|
630
1406
|
} finally {
|
|
631
|
-
wasm.
|
|
1407
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1408
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
632
1409
|
}
|
|
633
1410
|
}
|
|
634
1411
|
|
|
@@ -665,17 +1442,25 @@ export function policyRulesFromToml(toml_src) {
|
|
|
665
1442
|
* @returns {Uint8Array}
|
|
666
1443
|
*/
|
|
667
1444
|
export function quorumCosignPayload(suspended_content_json, threshold, roster_json, approver_record_json) {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
1445
|
+
try {
|
|
1446
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1447
|
+
const ptr0 = passStringToWasm0(suspended_content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1448
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1449
|
+
const ptr1 = passStringToWasm0(roster_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1450
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1451
|
+
const ptr2 = passStringToWasm0(approver_record_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1452
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1453
|
+
wasm.quorumCosignPayload(retptr, ptr0, len0, threshold, ptr1, len1, ptr2, len2);
|
|
1454
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1455
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1456
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1457
|
+
if (r2) {
|
|
1458
|
+
throw takeObject(r1);
|
|
1459
|
+
}
|
|
1460
|
+
return takeObject(r0);
|
|
1461
|
+
} finally {
|
|
1462
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
677
1463
|
}
|
|
678
|
-
return takeFromExternrefTable0(ret[0]);
|
|
679
1464
|
}
|
|
680
1465
|
|
|
681
1466
|
/**
|
|
@@ -689,20 +1474,26 @@ export function ruleToSentence(rule_json) {
|
|
|
689
1474
|
let deferred3_0;
|
|
690
1475
|
let deferred3_1;
|
|
691
1476
|
try {
|
|
692
|
-
const
|
|
1477
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1478
|
+
const ptr0 = passStringToWasm0(rule_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
693
1479
|
const len0 = WASM_VECTOR_LEN;
|
|
694
|
-
|
|
695
|
-
var
|
|
696
|
-
var
|
|
697
|
-
|
|
1480
|
+
wasm.ruleToSentence(retptr, ptr0, len0);
|
|
1481
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1482
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1483
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1484
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1485
|
+
var ptr2 = r0;
|
|
1486
|
+
var len2 = r1;
|
|
1487
|
+
if (r3) {
|
|
698
1488
|
ptr2 = 0; len2 = 0;
|
|
699
|
-
throw
|
|
1489
|
+
throw takeObject(r2);
|
|
700
1490
|
}
|
|
701
1491
|
deferred3_0 = ptr2;
|
|
702
1492
|
deferred3_1 = len2;
|
|
703
1493
|
return getStringFromWasm0(ptr2, len2);
|
|
704
1494
|
} finally {
|
|
705
|
-
wasm.
|
|
1495
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1496
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
706
1497
|
}
|
|
707
1498
|
}
|
|
708
1499
|
|
|
@@ -717,22 +1508,67 @@ export function shortHash(hex, prefix) {
|
|
|
717
1508
|
let deferred4_0;
|
|
718
1509
|
let deferred4_1;
|
|
719
1510
|
try {
|
|
720
|
-
const
|
|
1511
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1512
|
+
const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
721
1513
|
const len0 = WASM_VECTOR_LEN;
|
|
722
|
-
var ptr1 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.
|
|
1514
|
+
var ptr1 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
723
1515
|
var len1 = WASM_VECTOR_LEN;
|
|
724
|
-
|
|
725
|
-
var
|
|
726
|
-
var
|
|
727
|
-
|
|
1516
|
+
wasm.shortHash(retptr, ptr0, len0, ptr1, len1);
|
|
1517
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1518
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1519
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1520
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1521
|
+
var ptr3 = r0;
|
|
1522
|
+
var len3 = r1;
|
|
1523
|
+
if (r3) {
|
|
1524
|
+
ptr3 = 0; len3 = 0;
|
|
1525
|
+
throw takeObject(r2);
|
|
1526
|
+
}
|
|
1527
|
+
deferred4_0 = ptr3;
|
|
1528
|
+
deferred4_1 = len3;
|
|
1529
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1530
|
+
} finally {
|
|
1531
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1532
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* The frozen top-tree leaf VALUE committing one org's epoch snapshot:
|
|
1538
|
+
* `SHA-256(TOP_LEAF_DOMAIN || org_id(16) || epoch(BE8) || org_root(32))`,
|
|
1539
|
+
* 64-hex. The stage-2 commitment a two-stage inclusion proof rides. Throws
|
|
1540
|
+
* `[ORG]`/`[ROOT]` on malformed inputs.
|
|
1541
|
+
* @param {string} org_id_hyphenated
|
|
1542
|
+
* @param {bigint} epoch
|
|
1543
|
+
* @param {string} org_root_hex
|
|
1544
|
+
* @returns {string}
|
|
1545
|
+
*/
|
|
1546
|
+
export function topLeafValue(org_id_hyphenated, epoch, org_root_hex) {
|
|
1547
|
+
let deferred4_0;
|
|
1548
|
+
let deferred4_1;
|
|
1549
|
+
try {
|
|
1550
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1551
|
+
const ptr0 = passStringToWasm0(org_id_hyphenated, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1552
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1553
|
+
const ptr1 = passStringToWasm0(org_root_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1554
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1555
|
+
wasm.topLeafValue(retptr, ptr0, len0, epoch, ptr1, len1);
|
|
1556
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1557
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1558
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1559
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1560
|
+
var ptr3 = r0;
|
|
1561
|
+
var len3 = r1;
|
|
1562
|
+
if (r3) {
|
|
728
1563
|
ptr3 = 0; len3 = 0;
|
|
729
|
-
throw
|
|
1564
|
+
throw takeObject(r2);
|
|
730
1565
|
}
|
|
731
1566
|
deferred4_0 = ptr3;
|
|
732
1567
|
deferred4_1 = len3;
|
|
733
1568
|
return getStringFromWasm0(ptr3, len3);
|
|
734
1569
|
} finally {
|
|
735
|
-
wasm.
|
|
1570
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1571
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
736
1572
|
}
|
|
737
1573
|
}
|
|
738
1574
|
|
|
@@ -745,11 +1581,18 @@ export function shortHash(hex, prefix) {
|
|
|
745
1581
|
* @param {string} rules_json
|
|
746
1582
|
*/
|
|
747
1583
|
export function validateNoFloorBypass(rules_json) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
1584
|
+
try {
|
|
1585
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1586
|
+
const ptr0 = passStringToWasm0(rules_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1588
|
+
wasm.validateNoFloorBypass(retptr, ptr0, len0);
|
|
1589
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1590
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1591
|
+
if (r1) {
|
|
1592
|
+
throw takeObject(r0);
|
|
1593
|
+
}
|
|
1594
|
+
} finally {
|
|
1595
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
753
1596
|
}
|
|
754
1597
|
}
|
|
755
1598
|
|
|
@@ -768,12 +1611,41 @@ export function validateNoFloorBypass(rules_json) {
|
|
|
768
1611
|
* @returns {ActionVerdict}
|
|
769
1612
|
*/
|
|
770
1613
|
export function verifyActionReceipt(receipt_bytes) {
|
|
771
|
-
const ptr0 = passArray8ToWasm0(receipt_bytes, wasm.
|
|
1614
|
+
const ptr0 = passArray8ToWasm0(receipt_bytes, wasm.__wbindgen_export);
|
|
772
1615
|
const len0 = WASM_VECTOR_LEN;
|
|
773
1616
|
const ret = wasm.verifyActionReceipt(ptr0, len0);
|
|
774
1617
|
return ActionVerdict.__wrap(ret);
|
|
775
1618
|
}
|
|
776
1619
|
|
|
1620
|
+
/**
|
|
1621
|
+
* Verify a single `ActionReceipt` AND render its signed metrics + recompute cost
|
|
1622
|
+
* from the passed-in public rate card.
|
|
1623
|
+
*
|
|
1624
|
+
* Runs the EXISTING [`verify_action_receipt`] for the base outcome + trust level
|
|
1625
|
+
* (so that path is byte-for-byte unchanged), then — when the receipt parses —
|
|
1626
|
+
* renders the signed metrics and recomputes the cost via the pure
|
|
1627
|
+
* `heso_action::metrics_view::metrics_view`. Never panics:
|
|
1628
|
+
*
|
|
1629
|
+
* - receipt fails to PARSE ⇒ base verdict + `has_metrics: false` (no metrics).
|
|
1630
|
+
* - rate card fails to PARSE ⇒ base verdict + rendered metrics, but `priced:
|
|
1631
|
+
* false` and `cost_display: None` (cost cannot be recomputed without a card).
|
|
1632
|
+
* - everything parses ⇒ full metrics + recomputed cost.
|
|
1633
|
+
*
|
|
1634
|
+
* `receipt_bytes` — the raw `ActionReceipt` JSON bytes (`Uint8Array`).
|
|
1635
|
+
* `rate_card_json` — the public rate-card JSON the cost is recomputed from.
|
|
1636
|
+
* @param {Uint8Array} receipt_bytes
|
|
1637
|
+
* @param {string} rate_card_json
|
|
1638
|
+
* @returns {MetricsVerdict}
|
|
1639
|
+
*/
|
|
1640
|
+
export function verifyActionReceiptWithRates(receipt_bytes, rate_card_json) {
|
|
1641
|
+
const ptr0 = passArray8ToWasm0(receipt_bytes, wasm.__wbindgen_export);
|
|
1642
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1643
|
+
const ptr1 = passStringToWasm0(rate_card_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1644
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1645
|
+
const ret = wasm.verifyActionReceiptWithRates(ptr0, len0, ptr1, len1);
|
|
1646
|
+
return MetricsVerdict.__wrap(ret);
|
|
1647
|
+
}
|
|
1648
|
+
|
|
777
1649
|
/**
|
|
778
1650
|
* Verify a serialized approval token and return its decoded claims.
|
|
779
1651
|
*
|
|
@@ -799,19 +1671,27 @@ export function verifyActionReceipt(receipt_bytes) {
|
|
|
799
1671
|
* @returns {ApprovalTokenClaims}
|
|
800
1672
|
*/
|
|
801
1673
|
export function verifyApprovalToken(token, action_canonical, now_unix_secs, seen_nonces, required_scope, required_decision, registered_keys_b64) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1674
|
+
try {
|
|
1675
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1676
|
+
const ptr0 = passArray8ToWasm0(token, wasm.__wbindgen_export);
|
|
1677
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1678
|
+
const ptr1 = passArray8ToWasm0(action_canonical, wasm.__wbindgen_export);
|
|
1679
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1680
|
+
const ptr2 = passStringToWasm0(required_scope, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1681
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1682
|
+
const ptr3 = passStringToWasm0(required_decision, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1683
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1684
|
+
wasm.verifyApprovalToken(retptr, ptr0, len0, ptr1, len1, addHeapObject(now_unix_secs), addHeapObject(seen_nonces), ptr2, len2, ptr3, len3, addHeapObject(registered_keys_b64));
|
|
1685
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1686
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1687
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1688
|
+
if (r2) {
|
|
1689
|
+
throw takeObject(r1);
|
|
1690
|
+
}
|
|
1691
|
+
return ApprovalTokenClaims.__wrap(r0);
|
|
1692
|
+
} finally {
|
|
1693
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
813
1694
|
}
|
|
814
|
-
return ApprovalTokenClaims.__wrap(ret[0]);
|
|
815
1695
|
}
|
|
816
1696
|
|
|
817
1697
|
/**
|
|
@@ -822,13 +1702,51 @@ export function verifyApprovalToken(token, action_canonical, now_unix_secs, seen
|
|
|
822
1702
|
* @returns {ChainResult}
|
|
823
1703
|
*/
|
|
824
1704
|
export function verifyChain(receipts_bytes) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1705
|
+
try {
|
|
1706
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1707
|
+
const ptr0 = passArray8ToWasm0(receipts_bytes, wasm.__wbindgen_export);
|
|
1708
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1709
|
+
wasm.verifyChain(retptr, ptr0, len0);
|
|
1710
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1711
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1712
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1713
|
+
if (r2) {
|
|
1714
|
+
throw takeObject(r1);
|
|
1715
|
+
}
|
|
1716
|
+
return ChainResult.__wrap(r0);
|
|
1717
|
+
} finally {
|
|
1718
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
830
1719
|
}
|
|
831
|
-
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* REJECT-MORE-ONLY. Verify a detached commitment-envelope signature in the
|
|
1724
|
+
* browser — the recipient independently confirms a commitment the same way the
|
|
1725
|
+
* cloud does.
|
|
1726
|
+
*
|
|
1727
|
+
* Parses `envelope_bytes` as a `CommitmentEnvelope`, re-canonicalizes VIA THE
|
|
1728
|
+
* KERNEL, `verify_strict`-checks the detached Ed25519 signature under
|
|
1729
|
+
* `COMMITMENT_SIGNING_DOMAIN`, and confirms the recomputed commitment
|
|
1730
|
+
* fingerprint (`blake3(pubkey)`) equals `claimed_signer_fpr`. Produces ZERO new
|
|
1731
|
+
* canonical/signed bytes. Never throws — every outcome is a kind-tagged
|
|
1732
|
+
* [`CommitmentVerdict`].
|
|
1733
|
+
* @param {Uint8Array} envelope_bytes
|
|
1734
|
+
* @param {string} operator_pubkey_b64
|
|
1735
|
+
* @param {string} detached_sig_b64
|
|
1736
|
+
* @param {string} claimed_signer_fpr
|
|
1737
|
+
* @returns {CommitmentVerdict}
|
|
1738
|
+
*/
|
|
1739
|
+
export function verifyCommitment(envelope_bytes, operator_pubkey_b64, detached_sig_b64, claimed_signer_fpr) {
|
|
1740
|
+
const ptr0 = passArray8ToWasm0(envelope_bytes, wasm.__wbindgen_export);
|
|
1741
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1742
|
+
const ptr1 = passStringToWasm0(operator_pubkey_b64, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1743
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1744
|
+
const ptr2 = passStringToWasm0(detached_sig_b64, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1745
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1746
|
+
const ptr3 = passStringToWasm0(claimed_signer_fpr, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1747
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1748
|
+
const ret = wasm.verifyCommitment(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1749
|
+
return CommitmentVerdict.__wrap(ret);
|
|
832
1750
|
}
|
|
833
1751
|
|
|
834
1752
|
/**
|
|
@@ -843,17 +1761,25 @@ export function verifyChain(receipts_bytes) {
|
|
|
843
1761
|
* @returns {boolean}
|
|
844
1762
|
*/
|
|
845
1763
|
export function verifyConsistency(old_size, old_root_hex, new_size, new_root_hex, proof_hashes_json) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1764
|
+
try {
|
|
1765
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1766
|
+
const ptr0 = passStringToWasm0(old_root_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1767
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1768
|
+
const ptr1 = passStringToWasm0(new_root_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1769
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1770
|
+
const ptr2 = passStringToWasm0(proof_hashes_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1771
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1772
|
+
wasm.verifyConsistency(retptr, old_size, ptr0, len0, new_size, ptr1, len1, ptr2, len2);
|
|
1773
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1774
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1775
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1776
|
+
if (r2) {
|
|
1777
|
+
throw takeObject(r1);
|
|
1778
|
+
}
|
|
1779
|
+
return r0 !== 0;
|
|
1780
|
+
} finally {
|
|
1781
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
855
1782
|
}
|
|
856
|
-
return ret[0] !== 0;
|
|
857
1783
|
}
|
|
858
1784
|
|
|
859
1785
|
/**
|
|
@@ -881,23 +1807,31 @@ export function verifyConsistency(old_size, old_root_hex, new_size, new_root_hex
|
|
|
881
1807
|
* @returns {VerifiedDelegation}
|
|
882
1808
|
*/
|
|
883
1809
|
export function verifyDelegation(wire, registered_operator_key, action_hash, approval_token, required_scope, required_decision, now_unix_secs) {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1810
|
+
try {
|
|
1811
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1812
|
+
const ptr0 = passArray8ToWasm0(wire, wasm.__wbindgen_export);
|
|
1813
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1814
|
+
const ptr1 = passArray8ToWasm0(registered_operator_key, wasm.__wbindgen_export);
|
|
1815
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1816
|
+
const ptr2 = passArray8ToWasm0(action_hash, wasm.__wbindgen_export);
|
|
1817
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1818
|
+
const ptr3 = passArray8ToWasm0(approval_token, wasm.__wbindgen_export);
|
|
1819
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1820
|
+
const ptr4 = passStringToWasm0(required_scope, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1821
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1822
|
+
const ptr5 = passStringToWasm0(required_decision, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1823
|
+
const len5 = WASM_VECTOR_LEN;
|
|
1824
|
+
wasm.verifyDelegation(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, addHeapObject(now_unix_secs));
|
|
1825
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1826
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1827
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1828
|
+
if (r2) {
|
|
1829
|
+
throw takeObject(r1);
|
|
1830
|
+
}
|
|
1831
|
+
return VerifiedDelegation.__wrap(r0);
|
|
1832
|
+
} finally {
|
|
1833
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1834
|
+
}
|
|
901
1835
|
}
|
|
902
1836
|
|
|
903
1837
|
/**
|
|
@@ -917,17 +1851,92 @@ export function verifyDelegation(wire, registered_operator_key, action_hash, app
|
|
|
917
1851
|
* @returns {boolean}
|
|
918
1852
|
*/
|
|
919
1853
|
export function verifyInclusion(leaf_value_hex, index, size, root_hex, proof_hashes_json) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1854
|
+
try {
|
|
1855
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1856
|
+
const ptr0 = passStringToWasm0(leaf_value_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1857
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1858
|
+
const ptr1 = passStringToWasm0(root_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1859
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1860
|
+
const ptr2 = passStringToWasm0(proof_hashes_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1861
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1862
|
+
wasm.verifyInclusion(retptr, ptr0, len0, index, size, ptr1, len1, ptr2, len2);
|
|
1863
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1864
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1865
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1866
|
+
if (r2) {
|
|
1867
|
+
throw takeObject(r1);
|
|
1868
|
+
}
|
|
1869
|
+
return r0 !== 0;
|
|
1870
|
+
} finally {
|
|
1871
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Verify a parsed C2SP signed-note checkpoint against a PINNED Ed25519 log
|
|
1877
|
+
* public key (base64, raw 32 bytes). Returns `true` iff at least one signature
|
|
1878
|
+
* line is from the pinned key AND `verify_strict`s over the note text.
|
|
1879
|
+
*
|
|
1880
|
+
* The pinned key is supplied by the caller (trusted out of band, CT-style) — a
|
|
1881
|
+
* note signed by any non-pinned key returns `false`. Throws `[NOTE]` if the
|
|
1882
|
+
* note is malformed or `[KEY]` if the pubkey is not base64 of 32 bytes.
|
|
1883
|
+
* @param {string} note
|
|
1884
|
+
* @param {string} log_pubkey_b64
|
|
1885
|
+
* @returns {boolean}
|
|
1886
|
+
*/
|
|
1887
|
+
export function verifyNoteAgainstKey(note, log_pubkey_b64) {
|
|
1888
|
+
try {
|
|
1889
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1890
|
+
const ptr0 = passStringToWasm0(note, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1891
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1892
|
+
const ptr1 = passStringToWasm0(log_pubkey_b64, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1893
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1894
|
+
wasm.verifyNoteAgainstKey(retptr, ptr0, len0, ptr1, len1);
|
|
1895
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1896
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1897
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1898
|
+
if (r2) {
|
|
1899
|
+
throw takeObject(r1);
|
|
1900
|
+
}
|
|
1901
|
+
return r0 !== 0;
|
|
1902
|
+
} finally {
|
|
1903
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
/**
|
|
1908
|
+
* Verify a single commit-and-reveal field reveal against its signed redaction
|
|
1909
|
+
* marker — recompute `BLAKE3(salt ++ field_path ++ value)` and check equality
|
|
1910
|
+
* with `marker.commitment`. The browser/offline counterpart to the Node
|
|
1911
|
+
* `verifyRevealJs`: the missing half that lets a web auditor reveal-and-prove a
|
|
1912
|
+
* redacted field with only the receipt + the customer-supplied sidecar.
|
|
1913
|
+
*
|
|
1914
|
+
* `reveal_json` — a `FieldReveal`: `{ field_path, salt_hex, value_json }`.
|
|
1915
|
+
* `marker_json` — the matching `RedactionMarker` from the signed receipt.
|
|
1916
|
+
*
|
|
1917
|
+
* Returns `true` iff the reveal recomputes the marker's commitment.
|
|
1918
|
+
* @param {string} reveal_json
|
|
1919
|
+
* @param {string} marker_json
|
|
1920
|
+
* @returns {boolean}
|
|
1921
|
+
*/
|
|
1922
|
+
export function verifyReveal(reveal_json, marker_json) {
|
|
1923
|
+
try {
|
|
1924
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1925
|
+
const ptr0 = passStringToWasm0(reveal_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1926
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1927
|
+
const ptr1 = passStringToWasm0(marker_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1928
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1929
|
+
wasm.verifyReveal(retptr, ptr0, len0, ptr1, len1);
|
|
1930
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1931
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1932
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1933
|
+
if (r2) {
|
|
1934
|
+
throw takeObject(r1);
|
|
1935
|
+
}
|
|
1936
|
+
return r0 !== 0;
|
|
1937
|
+
} finally {
|
|
1938
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
929
1939
|
}
|
|
930
|
-
return ret[0] !== 0;
|
|
931
1940
|
}
|
|
932
1941
|
|
|
933
1942
|
/**
|
|
@@ -936,13 +1945,21 @@ export function verifyInclusion(leaf_value_hex, index, size, root_hex, proof_has
|
|
|
936
1945
|
* @returns {ChainResult}
|
|
937
1946
|
*/
|
|
938
1947
|
export function verifySessionChain(receipts_bytes) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1948
|
+
try {
|
|
1949
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1950
|
+
const ptr0 = passArray8ToWasm0(receipts_bytes, wasm.__wbindgen_export);
|
|
1951
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1952
|
+
wasm.verifySessionChain(retptr, ptr0, len0);
|
|
1953
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1954
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1955
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1956
|
+
if (r2) {
|
|
1957
|
+
throw takeObject(r1);
|
|
1958
|
+
}
|
|
1959
|
+
return ChainResult.__wrap(r0);
|
|
1960
|
+
} finally {
|
|
1961
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
944
1962
|
}
|
|
945
|
-
return ChainResult.__wrap(ret[0]);
|
|
946
1963
|
}
|
|
947
1964
|
|
|
948
1965
|
/**
|
|
@@ -956,39 +1973,47 @@ export function verifySessionChain(receipts_bytes) {
|
|
|
956
1973
|
* @returns {ChainResult}
|
|
957
1974
|
*/
|
|
958
1975
|
export function verifySessionChainWithRotation(receipts_bytes, producer_key, decision_key) {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1976
|
+
try {
|
|
1977
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1978
|
+
const ptr0 = passArray8ToWasm0(receipts_bytes, wasm.__wbindgen_export);
|
|
1979
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1980
|
+
const ptr1 = passStringToWasm0(producer_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1981
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1982
|
+
var ptr2 = isLikeNone(decision_key) ? 0 : passStringToWasm0(decision_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1983
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1984
|
+
wasm.verifySessionChainWithRotation(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1985
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1986
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1987
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1988
|
+
if (r2) {
|
|
1989
|
+
throw takeObject(r1);
|
|
1990
|
+
}
|
|
1991
|
+
return ChainResult.__wrap(r0);
|
|
1992
|
+
} finally {
|
|
1993
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
968
1994
|
}
|
|
969
|
-
return ChainResult.__wrap(ret[0]);
|
|
970
1995
|
}
|
|
971
1996
|
function __wbg_get_imports() {
|
|
972
1997
|
const import0 = {
|
|
973
1998
|
__proto__: null,
|
|
974
1999
|
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
975
2000
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
976
|
-
return ret;
|
|
2001
|
+
return addHeapObject(ret);
|
|
977
2002
|
},
|
|
978
2003
|
__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
|
|
979
|
-
const v = arg1;
|
|
2004
|
+
const v = getObject(arg1);
|
|
980
2005
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
981
2006
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
982
2007
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
983
2008
|
},
|
|
984
2009
|
__wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
|
|
985
|
-
const ret = arg0 === arg1;
|
|
2010
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
986
2011
|
return ret;
|
|
987
2012
|
},
|
|
988
2013
|
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
989
|
-
const obj = arg1;
|
|
2014
|
+
const obj = getObject(arg1);
|
|
990
2015
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
991
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.
|
|
2016
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
992
2017
|
var len1 = WASM_VECTOR_LEN;
|
|
993
2018
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
994
2019
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
@@ -997,44 +2022,42 @@ function __wbg_get_imports() {
|
|
|
997
2022
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
998
2023
|
},
|
|
999
2024
|
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
1000
|
-
const ret = arg0[arg1 >>> 0];
|
|
1001
|
-
return ret;
|
|
2025
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
2026
|
+
return addHeapObject(ret);
|
|
1002
2027
|
},
|
|
1003
2028
|
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
1004
|
-
const ret = arg0.length;
|
|
2029
|
+
const ret = getObject(arg0).length;
|
|
1005
2030
|
return ret;
|
|
1006
2031
|
},
|
|
1007
2032
|
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
1008
|
-
const ret = arg0.length;
|
|
2033
|
+
const ret = getObject(arg0).length;
|
|
1009
2034
|
return ret;
|
|
1010
2035
|
},
|
|
1011
2036
|
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
1012
2037
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1013
|
-
return ret;
|
|
2038
|
+
return addHeapObject(ret);
|
|
1014
2039
|
},
|
|
1015
2040
|
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
1016
2041
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
1017
|
-
return ret;
|
|
2042
|
+
return addHeapObject(ret);
|
|
1018
2043
|
},
|
|
1019
2044
|
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
1020
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
2045
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
1021
2046
|
},
|
|
1022
2047
|
__wbg_set_29c99a8aac1c01e5: function(arg0, arg1, arg2) {
|
|
1023
|
-
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
2048
|
+
getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
|
|
1024
2049
|
},
|
|
1025
2050
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
1026
2051
|
// Cast intrinsic for `U64 -> Externref`.
|
|
1027
2052
|
const ret = BigInt.asUintN(64, arg0);
|
|
1028
|
-
return ret;
|
|
2053
|
+
return addHeapObject(ret);
|
|
1029
2054
|
},
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
table.set(offset + 2, true);
|
|
1037
|
-
table.set(offset + 3, false);
|
|
2055
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
2056
|
+
const ret = getObject(arg0);
|
|
2057
|
+
return addHeapObject(ret);
|
|
2058
|
+
},
|
|
2059
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
2060
|
+
takeObject(arg0);
|
|
1038
2061
|
},
|
|
1039
2062
|
};
|
|
1040
2063
|
return {
|
|
@@ -1052,10 +2075,31 @@ const ApprovalTokenClaimsFinalization = (typeof FinalizationRegistry === 'undefi
|
|
|
1052
2075
|
const ChainResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1053
2076
|
? { register: () => {}, unregister: () => {} }
|
|
1054
2077
|
: new FinalizationRegistry(ptr => wasm.__wbg_chainresult_free(ptr, 1));
|
|
2078
|
+
const CommitmentVerdictFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2079
|
+
? { register: () => {}, unregister: () => {} }
|
|
2080
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_commitmentverdict_free(ptr, 1));
|
|
2081
|
+
const MetricsVerdictFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2082
|
+
? { register: () => {}, unregister: () => {} }
|
|
2083
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_metricsverdict_free(ptr, 1));
|
|
1055
2084
|
const VerifiedDelegationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1056
2085
|
? { register: () => {}, unregister: () => {} }
|
|
1057
2086
|
: new FinalizationRegistry(ptr => wasm.__wbg_verifieddelegation_free(ptr, 1));
|
|
1058
2087
|
|
|
2088
|
+
function addHeapObject(obj) {
|
|
2089
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
2090
|
+
const idx = heap_next;
|
|
2091
|
+
heap_next = heap[idx];
|
|
2092
|
+
|
|
2093
|
+
heap[idx] = obj;
|
|
2094
|
+
return idx;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
function dropObject(idx) {
|
|
2098
|
+
if (idx < 1028) return;
|
|
2099
|
+
heap[idx] = heap_next;
|
|
2100
|
+
heap_next = idx;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
1059
2103
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1060
2104
|
ptr = ptr >>> 0;
|
|
1061
2105
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -1081,6 +2125,13 @@ function getUint8ArrayMemory0() {
|
|
|
1081
2125
|
return cachedUint8ArrayMemory0;
|
|
1082
2126
|
}
|
|
1083
2127
|
|
|
2128
|
+
function getObject(idx) { return heap[idx]; }
|
|
2129
|
+
|
|
2130
|
+
let heap = new Array(1024).fill(undefined);
|
|
2131
|
+
heap.push(undefined, null, true, false);
|
|
2132
|
+
|
|
2133
|
+
let heap_next = heap.length;
|
|
2134
|
+
|
|
1084
2135
|
function isLikeNone(x) {
|
|
1085
2136
|
return x === undefined || x === null;
|
|
1086
2137
|
}
|
|
@@ -1129,10 +2180,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
1129
2180
|
return ptr;
|
|
1130
2181
|
}
|
|
1131
2182
|
|
|
1132
|
-
function
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
return
|
|
2183
|
+
function takeObject(idx) {
|
|
2184
|
+
const ret = getObject(idx);
|
|
2185
|
+
dropObject(idx);
|
|
2186
|
+
return ret;
|
|
1136
2187
|
}
|
|
1137
2188
|
|
|
1138
2189
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -1171,7 +2222,6 @@ function __wbg_finalize_init(instance, module) {
|
|
|
1171
2222
|
wasmModule = module;
|
|
1172
2223
|
cachedDataViewMemory0 = null;
|
|
1173
2224
|
cachedUint8ArrayMemory0 = null;
|
|
1174
|
-
wasm.__wbindgen_start();
|
|
1175
2225
|
return wasm;
|
|
1176
2226
|
}
|
|
1177
2227
|
|