@officialunofficial/kit-wasm 0.0.0-init → 0.7.1

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/kit_wasm_bg.js ADDED
@@ -0,0 +1,2977 @@
1
+ export class AttestKeyPairJs {
2
+ static __wrap(ptr) {
3
+ const obj = Object.create(AttestKeyPairJs.prototype);
4
+ obj.__wbg_ptr = ptr;
5
+ AttestKeyPairJsFinalization.register(obj, obj.__wbg_ptr, obj);
6
+ return obj;
7
+ }
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ AttestKeyPairJsFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_attestkeypairjs_free(ptr, 0);
17
+ }
18
+ /**
19
+ * @returns {string}
20
+ */
21
+ get algo() {
22
+ let deferred1_0;
23
+ let deferred1_1;
24
+ try {
25
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
26
+ wasm.attestkeypairjs_algo(retptr, this.__wbg_ptr);
27
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
28
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
29
+ deferred1_0 = r0;
30
+ deferred1_1 = r1;
31
+ return getStringFromWasm0(r0, r1);
32
+ } finally {
33
+ wasm.__wbindgen_add_to_stack_pointer(16);
34
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
35
+ }
36
+ }
37
+ /**
38
+ * @returns {string}
39
+ */
40
+ get keyid() {
41
+ let deferred1_0;
42
+ let deferred1_1;
43
+ try {
44
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
45
+ wasm.attestkeypairjs_keyid(retptr, this.__wbg_ptr);
46
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
47
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
48
+ deferred1_0 = r0;
49
+ deferred1_1 = r1;
50
+ return getStringFromWasm0(r0, r1);
51
+ } finally {
52
+ wasm.__wbindgen_add_to_stack_pointer(16);
53
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
54
+ }
55
+ }
56
+ /**
57
+ * @returns {string}
58
+ */
59
+ get pubkey_hex() {
60
+ let deferred1_0;
61
+ let deferred1_1;
62
+ try {
63
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
64
+ wasm.attestkeypairjs_pubkey_hex(retptr, this.__wbg_ptr);
65
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
66
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
67
+ deferred1_0 = r0;
68
+ deferred1_1 = r1;
69
+ return getStringFromWasm0(r0, r1);
70
+ } finally {
71
+ wasm.__wbindgen_add_to_stack_pointer(16);
72
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
73
+ }
74
+ }
75
+ /**
76
+ * @returns {string}
77
+ */
78
+ get seed_hex() {
79
+ let deferred1_0;
80
+ let deferred1_1;
81
+ try {
82
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
83
+ wasm.attestkeypairjs_seed_hex(retptr, this.__wbg_ptr);
84
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
85
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
86
+ deferred1_0 = r0;
87
+ deferred1_1 = r1;
88
+ return getStringFromWasm0(r0, r1);
89
+ } finally {
90
+ wasm.__wbindgen_add_to_stack_pointer(16);
91
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
92
+ }
93
+ }
94
+ }
95
+ if (Symbol.dispose) AttestKeyPairJs.prototype[Symbol.dispose] = AttestKeyPairJs.prototype.free;
96
+
97
+ export class AttestationJs {
98
+ static __wrap(ptr) {
99
+ const obj = Object.create(AttestationJs.prototype);
100
+ obj.__wbg_ptr = ptr;
101
+ AttestationJsFinalization.register(obj, obj.__wbg_ptr, obj);
102
+ return obj;
103
+ }
104
+ __destroy_into_raw() {
105
+ const ptr = this.__wbg_ptr;
106
+ this.__wbg_ptr = 0;
107
+ AttestationJsFinalization.unregister(this);
108
+ return ptr;
109
+ }
110
+ free() {
111
+ const ptr = this.__destroy_into_raw();
112
+ wasm.__wbg_attestationjs_free(ptr, 0);
113
+ }
114
+ /**
115
+ * @returns {string}
116
+ */
117
+ get attestation_id_hex() {
118
+ let deferred1_0;
119
+ let deferred1_1;
120
+ try {
121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
+ wasm.attestationjs_attestation_id_hex(retptr, this.__wbg_ptr);
123
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
+ deferred1_0 = r0;
126
+ deferred1_1 = r1;
127
+ return getStringFromWasm0(r0, r1);
128
+ } finally {
129
+ wasm.__wbindgen_add_to_stack_pointer(16);
130
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
131
+ }
132
+ }
133
+ /**
134
+ * @returns {string}
135
+ */
136
+ get envelope_json() {
137
+ let deferred1_0;
138
+ let deferred1_1;
139
+ try {
140
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
141
+ wasm.attestationjs_envelope_json(retptr, this.__wbg_ptr);
142
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
+ deferred1_0 = r0;
145
+ deferred1_1 = r1;
146
+ return getStringFromWasm0(r0, r1);
147
+ } finally {
148
+ wasm.__wbindgen_add_to_stack_pointer(16);
149
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
150
+ }
151
+ }
152
+ /**
153
+ * @returns {string}
154
+ */
155
+ get keyid() {
156
+ let deferred1_0;
157
+ let deferred1_1;
158
+ try {
159
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
+ wasm.attestationjs_keyid(retptr, this.__wbg_ptr);
161
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
162
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
163
+ deferred1_0 = r0;
164
+ deferred1_1 = r1;
165
+ return getStringFromWasm0(r0, r1);
166
+ } finally {
167
+ wasm.__wbindgen_add_to_stack_pointer(16);
168
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
169
+ }
170
+ }
171
+ }
172
+ if (Symbol.dispose) AttestationJs.prototype[Symbol.dispose] = AttestationJs.prototype.free;
173
+
174
+ export class BaoEncoded {
175
+ static __wrap(ptr) {
176
+ const obj = Object.create(BaoEncoded.prototype);
177
+ obj.__wbg_ptr = ptr;
178
+ BaoEncodedFinalization.register(obj, obj.__wbg_ptr, obj);
179
+ return obj;
180
+ }
181
+ __destroy_into_raw() {
182
+ const ptr = this.__wbg_ptr;
183
+ this.__wbg_ptr = 0;
184
+ BaoEncodedFinalization.unregister(this);
185
+ return ptr;
186
+ }
187
+ free() {
188
+ const ptr = this.__destroy_into_raw();
189
+ wasm.__wbg_baoencoded_free(ptr, 0);
190
+ }
191
+ /**
192
+ * @returns {string}
193
+ */
194
+ get hash_hex() {
195
+ let deferred1_0;
196
+ let deferred1_1;
197
+ try {
198
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
199
+ wasm.baoencoded_hash_hex(retptr, this.__wbg_ptr);
200
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
201
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
202
+ deferred1_0 = r0;
203
+ deferred1_1 = r1;
204
+ return getStringFromWasm0(r0, r1);
205
+ } finally {
206
+ wasm.__wbindgen_add_to_stack_pointer(16);
207
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
208
+ }
209
+ }
210
+ /**
211
+ * @returns {Uint8Array}
212
+ */
213
+ get outboard() {
214
+ try {
215
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
216
+ wasm.baoencoded_outboard(retptr, this.__wbg_ptr);
217
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
218
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
219
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
220
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
221
+ return v1;
222
+ } finally {
223
+ wasm.__wbindgen_add_to_stack_pointer(16);
224
+ }
225
+ }
226
+ }
227
+ if (Symbol.dispose) BaoEncoded.prototype[Symbol.dispose] = BaoEncoded.prototype.free;
228
+
229
+ export class BaoVerify {
230
+ static __wrap(ptr) {
231
+ const obj = Object.create(BaoVerify.prototype);
232
+ obj.__wbg_ptr = ptr;
233
+ BaoVerifyFinalization.register(obj, obj.__wbg_ptr, obj);
234
+ return obj;
235
+ }
236
+ __destroy_into_raw() {
237
+ const ptr = this.__wbg_ptr;
238
+ this.__wbg_ptr = 0;
239
+ BaoVerifyFinalization.unregister(this);
240
+ return ptr;
241
+ }
242
+ free() {
243
+ const ptr = this.__destroy_into_raw();
244
+ wasm.__wbg_baoverify_free(ptr, 0);
245
+ }
246
+ /**
247
+ * @returns {Uint8Array | undefined}
248
+ */
249
+ get bytes() {
250
+ try {
251
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
+ wasm.baoverify_bytes(retptr, this.__wbg_ptr);
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ let v1;
256
+ if (r0 !== 0) {
257
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
258
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
259
+ }
260
+ return v1;
261
+ } finally {
262
+ wasm.__wbindgen_add_to_stack_pointer(16);
263
+ }
264
+ }
265
+ /**
266
+ * @returns {string | undefined}
267
+ */
268
+ get error() {
269
+ try {
270
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
271
+ wasm.baoverify_error(retptr, this.__wbg_ptr);
272
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
273
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
274
+ let v1;
275
+ if (r0 !== 0) {
276
+ v1 = getStringFromWasm0(r0, r1);
277
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
278
+ }
279
+ return v1;
280
+ } finally {
281
+ wasm.__wbindgen_add_to_stack_pointer(16);
282
+ }
283
+ }
284
+ /**
285
+ * @returns {boolean}
286
+ */
287
+ get ok() {
288
+ const ret = wasm.baoverify_ok(this.__wbg_ptr);
289
+ return ret !== 0;
290
+ }
291
+ }
292
+ if (Symbol.dispose) BaoVerify.prototype[Symbol.dispose] = BaoVerify.prototype.free;
293
+
294
+ /**
295
+ * One `FastCDC` chunk boundary plus its BLAKE3.
296
+ */
297
+ export class ChunkInfo {
298
+ static __wrap(ptr) {
299
+ const obj = Object.create(ChunkInfo.prototype);
300
+ obj.__wbg_ptr = ptr;
301
+ ChunkInfoFinalization.register(obj, obj.__wbg_ptr, obj);
302
+ return obj;
303
+ }
304
+ __destroy_into_raw() {
305
+ const ptr = this.__wbg_ptr;
306
+ this.__wbg_ptr = 0;
307
+ ChunkInfoFinalization.unregister(this);
308
+ return ptr;
309
+ }
310
+ free() {
311
+ const ptr = this.__destroy_into_raw();
312
+ wasm.__wbg_chunkinfo_free(ptr, 0);
313
+ }
314
+ /**
315
+ * @returns {string}
316
+ */
317
+ get hash_hex() {
318
+ let deferred1_0;
319
+ let deferred1_1;
320
+ try {
321
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
+ wasm.chunkinfo_hash_hex(retptr, this.__wbg_ptr);
323
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
324
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
325
+ deferred1_0 = r0;
326
+ deferred1_1 = r1;
327
+ return getStringFromWasm0(r0, r1);
328
+ } finally {
329
+ wasm.__wbindgen_add_to_stack_pointer(16);
330
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
331
+ }
332
+ }
333
+ /**
334
+ * @returns {number}
335
+ */
336
+ get len() {
337
+ const ret = wasm.chunkinfo_len(this.__wbg_ptr);
338
+ return ret >>> 0;
339
+ }
340
+ /**
341
+ * @returns {number}
342
+ */
343
+ get offset() {
344
+ const ret = wasm.chunkinfo_offset(this.__wbg_ptr);
345
+ return ret >>> 0;
346
+ }
347
+ }
348
+ if (Symbol.dispose) ChunkInfo.prototype[Symbol.dispose] = ChunkInfo.prototype.free;
349
+
350
+ export class ChunkedBlobJs {
351
+ static __wrap(ptr) {
352
+ const obj = Object.create(ChunkedBlobJs.prototype);
353
+ obj.__wbg_ptr = ptr;
354
+ ChunkedBlobJsFinalization.register(obj, obj.__wbg_ptr, obj);
355
+ return obj;
356
+ }
357
+ __destroy_into_raw() {
358
+ const ptr = this.__wbg_ptr;
359
+ this.__wbg_ptr = 0;
360
+ ChunkedBlobJsFinalization.unregister(this);
361
+ return ptr;
362
+ }
363
+ free() {
364
+ const ptr = this.__destroy_into_raw();
365
+ wasm.__wbg_chunkedblobjs_free(ptr, 0);
366
+ }
367
+ /**
368
+ * @returns {number}
369
+ */
370
+ get bytes_len() {
371
+ const ret = wasm.chunkedblobjs_bytes_len(this.__wbg_ptr);
372
+ return ret >>> 0;
373
+ }
374
+ /**
375
+ * @param {number} i
376
+ * @returns {ChunkInfo | undefined}
377
+ */
378
+ chunk(i) {
379
+ const ret = wasm.chunkedblobjs_chunk(this.__wbg_ptr, i);
380
+ return ret === 0 ? undefined : ChunkInfo.__wrap(ret);
381
+ }
382
+ /**
383
+ * @returns {number}
384
+ */
385
+ get chunk_count() {
386
+ const ret = wasm.chunkedblobjs_chunk_count(this.__wbg_ptr);
387
+ return ret >>> 0;
388
+ }
389
+ /**
390
+ * @returns {string}
391
+ */
392
+ get root_hash_hex() {
393
+ let deferred1_0;
394
+ let deferred1_1;
395
+ try {
396
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
397
+ wasm.chunkedblobjs_root_hash_hex(retptr, this.__wbg_ptr);
398
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
399
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
400
+ deferred1_0 = r0;
401
+ deferred1_1 = r1;
402
+ return getStringFromWasm0(r0, r1);
403
+ } finally {
404
+ wasm.__wbindgen_add_to_stack_pointer(16);
405
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
406
+ }
407
+ }
408
+ }
409
+ if (Symbol.dispose) ChunkedBlobJs.prototype[Symbol.dispose] = ChunkedBlobJs.prototype.free;
410
+
411
+ export class ChunkerResult {
412
+ static __wrap(ptr) {
413
+ const obj = Object.create(ChunkerResult.prototype);
414
+ obj.__wbg_ptr = ptr;
415
+ ChunkerResultFinalization.register(obj, obj.__wbg_ptr, obj);
416
+ return obj;
417
+ }
418
+ __destroy_into_raw() {
419
+ const ptr = this.__wbg_ptr;
420
+ this.__wbg_ptr = 0;
421
+ ChunkerResultFinalization.unregister(this);
422
+ return ptr;
423
+ }
424
+ free() {
425
+ const ptr = this.__destroy_into_raw();
426
+ wasm.__wbg_chunkerresult_free(ptr, 0);
427
+ }
428
+ /**
429
+ * @returns {number}
430
+ */
431
+ get avg() {
432
+ const ret = wasm.chunkerresult_avg(this.__wbg_ptr);
433
+ return ret >>> 0;
434
+ }
435
+ /**
436
+ * @param {number} i
437
+ * @returns {ChunkInfo | undefined}
438
+ */
439
+ chunk(i) {
440
+ const ret = wasm.chunkerresult_chunk(this.__wbg_ptr, i);
441
+ return ret === 0 ? undefined : ChunkInfo.__wrap(ret);
442
+ }
443
+ /**
444
+ * Number of chunks. The `chunk(i)` getter returns each one by index,
445
+ * which is cheaper than materialising a JS array of opaque handles
446
+ * when the web caller only wants a few.
447
+ * @returns {number}
448
+ */
449
+ get chunk_count() {
450
+ const ret = wasm.chunkerresult_chunk_count(this.__wbg_ptr);
451
+ return ret >>> 0;
452
+ }
453
+ /**
454
+ * @returns {number}
455
+ */
456
+ get max() {
457
+ const ret = wasm.chunkerresult_max(this.__wbg_ptr);
458
+ return ret >>> 0;
459
+ }
460
+ /**
461
+ * @returns {number}
462
+ */
463
+ get min() {
464
+ const ret = wasm.chunkerresult_min(this.__wbg_ptr);
465
+ return ret >>> 0;
466
+ }
467
+ }
468
+ if (Symbol.dispose) ChunkerResult.prototype[Symbol.dispose] = ChunkerResult.prototype.free;
469
+
470
+ /**
471
+ * Decoded display fields of a commit object — what [`commit_decode`]
472
+ * returns for the multiplayer log to walk + render the room's `main`
473
+ * chain. `parents` are 64-hex object ids (parent 0 first); `signer_hex`
474
+ * is the 64-hex Ed25519 signer/author pubkey; `timestamp` is unix
475
+ * seconds; `tree_hex` is the 64-hex tree object id; `signature_hex` is
476
+ * the 128-hex Ed25519 signature.
477
+ */
478
+ export class CommitInfoJs {
479
+ static __wrap(ptr) {
480
+ const obj = Object.create(CommitInfoJs.prototype);
481
+ obj.__wbg_ptr = ptr;
482
+ CommitInfoJsFinalization.register(obj, obj.__wbg_ptr, obj);
483
+ return obj;
484
+ }
485
+ __destroy_into_raw() {
486
+ const ptr = this.__wbg_ptr;
487
+ this.__wbg_ptr = 0;
488
+ CommitInfoJsFinalization.unregister(this);
489
+ return ptr;
490
+ }
491
+ free() {
492
+ const ptr = this.__destroy_into_raw();
493
+ wasm.__wbg_commitinfojs_free(ptr, 0);
494
+ }
495
+ /**
496
+ * @returns {string}
497
+ */
498
+ get message() {
499
+ let deferred1_0;
500
+ let deferred1_1;
501
+ try {
502
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
503
+ wasm.commitinfojs_message(retptr, this.__wbg_ptr);
504
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
505
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
506
+ deferred1_0 = r0;
507
+ deferred1_1 = r1;
508
+ return getStringFromWasm0(r0, r1);
509
+ } finally {
510
+ wasm.__wbindgen_add_to_stack_pointer(16);
511
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
512
+ }
513
+ }
514
+ /**
515
+ * @param {number} i
516
+ * @returns {string | undefined}
517
+ */
518
+ parent(i) {
519
+ try {
520
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
521
+ wasm.commitinfojs_parent(retptr, this.__wbg_ptr, i);
522
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
523
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
524
+ let v1;
525
+ if (r0 !== 0) {
526
+ v1 = getStringFromWasm0(r0, r1);
527
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
528
+ }
529
+ return v1;
530
+ } finally {
531
+ wasm.__wbindgen_add_to_stack_pointer(16);
532
+ }
533
+ }
534
+ /**
535
+ * Number of parents; pair with [`CommitInfoJs::parent`] to read each
536
+ * 64-hex id by index, matching the `*_count` + indexed-getter shape
537
+ * used by the streaming result structs.
538
+ * @returns {number}
539
+ */
540
+ get parent_count() {
541
+ const ret = wasm.commitinfojs_parent_count(this.__wbg_ptr);
542
+ return ret >>> 0;
543
+ }
544
+ /**
545
+ * 128-hex Ed25519 signature over the commit's signing bytes.
546
+ * @returns {string}
547
+ */
548
+ get signature_hex() {
549
+ let deferred1_0;
550
+ let deferred1_1;
551
+ try {
552
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
553
+ wasm.commitinfojs_signature_hex(retptr, this.__wbg_ptr);
554
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
555
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
556
+ deferred1_0 = r0;
557
+ deferred1_1 = r1;
558
+ return getStringFromWasm0(r0, r1);
559
+ } finally {
560
+ wasm.__wbindgen_add_to_stack_pointer(16);
561
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
562
+ }
563
+ }
564
+ /**
565
+ * @returns {string}
566
+ */
567
+ get signer_hex() {
568
+ let deferred1_0;
569
+ let deferred1_1;
570
+ try {
571
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
572
+ wasm.commitinfojs_signer_hex(retptr, this.__wbg_ptr);
573
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
574
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
575
+ deferred1_0 = r0;
576
+ deferred1_1 = r1;
577
+ return getStringFromWasm0(r0, r1);
578
+ } finally {
579
+ wasm.__wbindgen_add_to_stack_pointer(16);
580
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
581
+ }
582
+ }
583
+ /**
584
+ * @returns {bigint}
585
+ */
586
+ get timestamp() {
587
+ const ret = wasm.commitinfojs_timestamp(this.__wbg_ptr);
588
+ return BigInt.asUintN(64, ret);
589
+ }
590
+ /**
591
+ * 64-hex id of the tree this commit snapshots.
592
+ * @returns {string}
593
+ */
594
+ get tree_hex() {
595
+ let deferred1_0;
596
+ let deferred1_1;
597
+ try {
598
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
599
+ wasm.commitinfojs_tree_hex(retptr, this.__wbg_ptr);
600
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
601
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
602
+ deferred1_0 = r0;
603
+ deferred1_1 = r1;
604
+ return getStringFromWasm0(r0, r1);
605
+ } finally {
606
+ wasm.__wbindgen_add_to_stack_pointer(16);
607
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
608
+ }
609
+ }
610
+ }
611
+ if (Symbol.dispose) CommitInfoJs.prototype[Symbol.dispose] = CommitInfoJs.prototype.free;
612
+
613
+ /**
614
+ * One entry in the delta summary. `offset` is populated only for `copy` ops.
615
+ */
616
+ export class DeltaOp {
617
+ static __wrap(ptr) {
618
+ const obj = Object.create(DeltaOp.prototype);
619
+ obj.__wbg_ptr = ptr;
620
+ DeltaOpFinalization.register(obj, obj.__wbg_ptr, obj);
621
+ return obj;
622
+ }
623
+ __destroy_into_raw() {
624
+ const ptr = this.__wbg_ptr;
625
+ this.__wbg_ptr = 0;
626
+ DeltaOpFinalization.unregister(this);
627
+ return ptr;
628
+ }
629
+ free() {
630
+ const ptr = this.__destroy_into_raw();
631
+ wasm.__wbg_deltaop_free(ptr, 0);
632
+ }
633
+ /**
634
+ * @returns {string}
635
+ */
636
+ get kind() {
637
+ let deferred1_0;
638
+ let deferred1_1;
639
+ try {
640
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
641
+ wasm.deltaop_kind(retptr, this.__wbg_ptr);
642
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
643
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
644
+ deferred1_0 = r0;
645
+ deferred1_1 = r1;
646
+ return getStringFromWasm0(r0, r1);
647
+ } finally {
648
+ wasm.__wbindgen_add_to_stack_pointer(16);
649
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
650
+ }
651
+ }
652
+ /**
653
+ * @returns {number}
654
+ */
655
+ get len() {
656
+ const ret = wasm.deltaop_len(this.__wbg_ptr);
657
+ return ret >>> 0;
658
+ }
659
+ /**
660
+ * @returns {number | undefined}
661
+ */
662
+ get offset() {
663
+ const ret = wasm.deltaop_offset(this.__wbg_ptr);
664
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
665
+ }
666
+ }
667
+ if (Symbol.dispose) DeltaOp.prototype[Symbol.dispose] = DeltaOp.prototype.free;
668
+
669
+ export class DeltaSummary {
670
+ static __wrap(ptr) {
671
+ const obj = Object.create(DeltaSummary.prototype);
672
+ obj.__wbg_ptr = ptr;
673
+ DeltaSummaryFinalization.register(obj, obj.__wbg_ptr, obj);
674
+ return obj;
675
+ }
676
+ __destroy_into_raw() {
677
+ const ptr = this.__wbg_ptr;
678
+ this.__wbg_ptr = 0;
679
+ DeltaSummaryFinalization.unregister(this);
680
+ return ptr;
681
+ }
682
+ free() {
683
+ const ptr = this.__destroy_into_raw();
684
+ wasm.__wbg_deltasummary_free(ptr, 0);
685
+ }
686
+ /**
687
+ * @returns {number}
688
+ */
689
+ get bytes_on_wire() {
690
+ const ret = wasm.deltasummary_bytes_on_wire(this.__wbg_ptr);
691
+ return ret >>> 0;
692
+ }
693
+ /**
694
+ * @returns {number}
695
+ */
696
+ get full_size() {
697
+ const ret = wasm.deltasummary_full_size(this.__wbg_ptr);
698
+ return ret >>> 0;
699
+ }
700
+ /**
701
+ * @param {number} i
702
+ * @returns {DeltaOp | undefined}
703
+ */
704
+ op(i) {
705
+ const ret = wasm.deltasummary_op(this.__wbg_ptr, i);
706
+ return ret === 0 ? undefined : DeltaOp.__wrap(ret);
707
+ }
708
+ /**
709
+ * @returns {number}
710
+ */
711
+ get op_count() {
712
+ const ret = wasm.deltasummary_op_count(this.__wbg_ptr);
713
+ return ret >>> 0;
714
+ }
715
+ }
716
+ if (Symbol.dispose) DeltaSummary.prototype[Symbol.dispose] = DeltaSummary.prototype.free;
717
+
718
+ export class EncodedCommit {
719
+ static __wrap(ptr) {
720
+ const obj = Object.create(EncodedCommit.prototype);
721
+ obj.__wbg_ptr = ptr;
722
+ EncodedCommitFinalization.register(obj, obj.__wbg_ptr, obj);
723
+ return obj;
724
+ }
725
+ __destroy_into_raw() {
726
+ const ptr = this.__wbg_ptr;
727
+ this.__wbg_ptr = 0;
728
+ EncodedCommitFinalization.unregister(this);
729
+ return ptr;
730
+ }
731
+ free() {
732
+ const ptr = this.__destroy_into_raw();
733
+ wasm.__wbg_encodedcommit_free(ptr, 0);
734
+ }
735
+ /**
736
+ * @returns {Uint8Array}
737
+ */
738
+ get bytes() {
739
+ try {
740
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
741
+ wasm.encodedcommit_bytes(retptr, this.__wbg_ptr);
742
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
743
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
744
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
745
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
746
+ return v1;
747
+ } finally {
748
+ wasm.__wbindgen_add_to_stack_pointer(16);
749
+ }
750
+ }
751
+ /**
752
+ * @returns {string}
753
+ */
754
+ get hash_hex() {
755
+ let deferred1_0;
756
+ let deferred1_1;
757
+ try {
758
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
759
+ wasm.encodedcommit_hash_hex(retptr, this.__wbg_ptr);
760
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
761
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
762
+ deferred1_0 = r0;
763
+ deferred1_1 = r1;
764
+ return getStringFromWasm0(r0, r1);
765
+ } finally {
766
+ wasm.__wbindgen_add_to_stack_pointer(16);
767
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
768
+ }
769
+ }
770
+ /**
771
+ * @returns {string}
772
+ */
773
+ get signature_hex() {
774
+ let deferred1_0;
775
+ let deferred1_1;
776
+ try {
777
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
778
+ wasm.encodedcommit_signature_hex(retptr, this.__wbg_ptr);
779
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
780
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
781
+ deferred1_0 = r0;
782
+ deferred1_1 = r1;
783
+ return getStringFromWasm0(r0, r1);
784
+ } finally {
785
+ wasm.__wbindgen_add_to_stack_pointer(16);
786
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
787
+ }
788
+ }
789
+ }
790
+ if (Symbol.dispose) EncodedCommit.prototype[Symbol.dispose] = EncodedCommit.prototype.free;
791
+
792
+ export class EncodedObject {
793
+ static __wrap(ptr) {
794
+ const obj = Object.create(EncodedObject.prototype);
795
+ obj.__wbg_ptr = ptr;
796
+ EncodedObjectFinalization.register(obj, obj.__wbg_ptr, obj);
797
+ return obj;
798
+ }
799
+ __destroy_into_raw() {
800
+ const ptr = this.__wbg_ptr;
801
+ this.__wbg_ptr = 0;
802
+ EncodedObjectFinalization.unregister(this);
803
+ return ptr;
804
+ }
805
+ free() {
806
+ const ptr = this.__destroy_into_raw();
807
+ wasm.__wbg_encodedobject_free(ptr, 0);
808
+ }
809
+ /**
810
+ * @returns {Uint8Array}
811
+ */
812
+ get bytes() {
813
+ try {
814
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
815
+ wasm.encodedobject_bytes(retptr, this.__wbg_ptr);
816
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
817
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
818
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
819
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
820
+ return v1;
821
+ } finally {
822
+ wasm.__wbindgen_add_to_stack_pointer(16);
823
+ }
824
+ }
825
+ /**
826
+ * @returns {string}
827
+ */
828
+ get hash_hex() {
829
+ let deferred1_0;
830
+ let deferred1_1;
831
+ try {
832
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
833
+ wasm.encodedobject_hash_hex(retptr, this.__wbg_ptr);
834
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
835
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
836
+ deferred1_0 = r0;
837
+ deferred1_1 = r1;
838
+ return getStringFromWasm0(r0, r1);
839
+ } finally {
840
+ wasm.__wbindgen_add_to_stack_pointer(16);
841
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
842
+ }
843
+ }
844
+ }
845
+ if (Symbol.dispose) EncodedObject.prototype[Symbol.dispose] = EncodedObject.prototype.free;
846
+
847
+ export class KeyPairJs {
848
+ static __wrap(ptr) {
849
+ const obj = Object.create(KeyPairJs.prototype);
850
+ obj.__wbg_ptr = ptr;
851
+ KeyPairJsFinalization.register(obj, obj.__wbg_ptr, obj);
852
+ return obj;
853
+ }
854
+ __destroy_into_raw() {
855
+ const ptr = this.__wbg_ptr;
856
+ this.__wbg_ptr = 0;
857
+ KeyPairJsFinalization.unregister(this);
858
+ return ptr;
859
+ }
860
+ free() {
861
+ const ptr = this.__destroy_into_raw();
862
+ wasm.__wbg_keypairjs_free(ptr, 0);
863
+ }
864
+ /**
865
+ * @returns {string}
866
+ */
867
+ get pubkey_hex() {
868
+ let deferred1_0;
869
+ let deferred1_1;
870
+ try {
871
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
872
+ wasm.keypairjs_pubkey_hex(retptr, this.__wbg_ptr);
873
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
874
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
875
+ deferred1_0 = r0;
876
+ deferred1_1 = r1;
877
+ return getStringFromWasm0(r0, r1);
878
+ } finally {
879
+ wasm.__wbindgen_add_to_stack_pointer(16);
880
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
881
+ }
882
+ }
883
+ /**
884
+ * @returns {string}
885
+ */
886
+ get seed_hex() {
887
+ let deferred1_0;
888
+ let deferred1_1;
889
+ try {
890
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
891
+ wasm.keypairjs_seed_hex(retptr, this.__wbg_ptr);
892
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
893
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
894
+ deferred1_0 = r0;
895
+ deferred1_1 = r1;
896
+ return getStringFromWasm0(r0, r1);
897
+ } finally {
898
+ wasm.__wbindgen_add_to_stack_pointer(16);
899
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
900
+ }
901
+ }
902
+ }
903
+ if (Symbol.dispose) KeyPairJs.prototype[Symbol.dispose] = KeyPairJs.prototype.free;
904
+
905
+ /**
906
+ * Decoded display fields of a remix object — the remix counterpart of
907
+ * [`CommitInfoJs`]. Carries the same commit-shaped fields plus the
908
+ * remix-only `sources` (read via `source_count` + the `source(i)`
909
+ * indexed getter), each a [`RemixSourceJs`] naming an upstream commit
910
+ * the fork derives from. `parents` are 64-hex object ids (parent 0
911
+ * first); `signer_hex` is the 64-hex Ed25519 signer pubkey; `timestamp`
912
+ * is unix seconds; `tree_hex` is the 64-hex tree id; `signature_hex` is
913
+ * the 128-hex Ed25519 signature.
914
+ */
915
+ export class RemixInfoJs {
916
+ static __wrap(ptr) {
917
+ const obj = Object.create(RemixInfoJs.prototype);
918
+ obj.__wbg_ptr = ptr;
919
+ RemixInfoJsFinalization.register(obj, obj.__wbg_ptr, obj);
920
+ return obj;
921
+ }
922
+ __destroy_into_raw() {
923
+ const ptr = this.__wbg_ptr;
924
+ this.__wbg_ptr = 0;
925
+ RemixInfoJsFinalization.unregister(this);
926
+ return ptr;
927
+ }
928
+ free() {
929
+ const ptr = this.__destroy_into_raw();
930
+ wasm.__wbg_remixinfojs_free(ptr, 0);
931
+ }
932
+ /**
933
+ * @returns {string}
934
+ */
935
+ get message() {
936
+ let deferred1_0;
937
+ let deferred1_1;
938
+ try {
939
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
940
+ wasm.remixinfojs_message(retptr, this.__wbg_ptr);
941
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
942
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
943
+ deferred1_0 = r0;
944
+ deferred1_1 = r1;
945
+ return getStringFromWasm0(r0, r1);
946
+ } finally {
947
+ wasm.__wbindgen_add_to_stack_pointer(16);
948
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
949
+ }
950
+ }
951
+ /**
952
+ * @param {number} i
953
+ * @returns {string | undefined}
954
+ */
955
+ parent(i) {
956
+ try {
957
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
958
+ wasm.remixinfojs_parent(retptr, this.__wbg_ptr, i);
959
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
960
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
961
+ let v1;
962
+ if (r0 !== 0) {
963
+ v1 = getStringFromWasm0(r0, r1);
964
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
965
+ }
966
+ return v1;
967
+ } finally {
968
+ wasm.__wbindgen_add_to_stack_pointer(16);
969
+ }
970
+ }
971
+ /**
972
+ * Number of parents; pair with [`RemixInfoJs::parent`] to read each
973
+ * 64-hex id by index.
974
+ * @returns {number}
975
+ */
976
+ get parent_count() {
977
+ const ret = wasm.remixinfojs_parent_count(this.__wbg_ptr);
978
+ return ret >>> 0;
979
+ }
980
+ /**
981
+ * 128-hex Ed25519 signature over the remix's signing bytes.
982
+ * @returns {string}
983
+ */
984
+ get signature_hex() {
985
+ let deferred1_0;
986
+ let deferred1_1;
987
+ try {
988
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
989
+ wasm.remixinfojs_signature_hex(retptr, this.__wbg_ptr);
990
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
991
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
992
+ deferred1_0 = r0;
993
+ deferred1_1 = r1;
994
+ return getStringFromWasm0(r0, r1);
995
+ } finally {
996
+ wasm.__wbindgen_add_to_stack_pointer(16);
997
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
998
+ }
999
+ }
1000
+ /**
1001
+ * @returns {string}
1002
+ */
1003
+ get signer_hex() {
1004
+ let deferred1_0;
1005
+ let deferred1_1;
1006
+ try {
1007
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1008
+ wasm.remixinfojs_signer_hex(retptr, this.__wbg_ptr);
1009
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1010
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1011
+ deferred1_0 = r0;
1012
+ deferred1_1 = r1;
1013
+ return getStringFromWasm0(r0, r1);
1014
+ } finally {
1015
+ wasm.__wbindgen_add_to_stack_pointer(16);
1016
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1017
+ }
1018
+ }
1019
+ /**
1020
+ * @param {number} i
1021
+ * @returns {RemixSourceJs | undefined}
1022
+ */
1023
+ source(i) {
1024
+ const ret = wasm.remixinfojs_source(this.__wbg_ptr, i);
1025
+ return ret === 0 ? undefined : RemixSourceJs.__wrap(ret);
1026
+ }
1027
+ /**
1028
+ * Number of sources (upstream commits this fork derives from); pair
1029
+ * with [`RemixInfoJs::source`] to read each `{ upstream_id_hex,
1030
+ * commit_hash_hex }` by index.
1031
+ * @returns {number}
1032
+ */
1033
+ get source_count() {
1034
+ const ret = wasm.remixinfojs_source_count(this.__wbg_ptr);
1035
+ return ret >>> 0;
1036
+ }
1037
+ /**
1038
+ * @returns {bigint}
1039
+ */
1040
+ get timestamp() {
1041
+ const ret = wasm.remixinfojs_timestamp(this.__wbg_ptr);
1042
+ return BigInt.asUintN(64, ret);
1043
+ }
1044
+ /**
1045
+ * 64-hex id of the tree this remix snapshots.
1046
+ * @returns {string}
1047
+ */
1048
+ get tree_hex() {
1049
+ let deferred1_0;
1050
+ let deferred1_1;
1051
+ try {
1052
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1053
+ wasm.remixinfojs_tree_hex(retptr, this.__wbg_ptr);
1054
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1055
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1056
+ deferred1_0 = r0;
1057
+ deferred1_1 = r1;
1058
+ return getStringFromWasm0(r0, r1);
1059
+ } finally {
1060
+ wasm.__wbindgen_add_to_stack_pointer(16);
1061
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1062
+ }
1063
+ }
1064
+ }
1065
+ if (Symbol.dispose) RemixInfoJs.prototype[Symbol.dispose] = RemixInfoJs.prototype.free;
1066
+
1067
+ /**
1068
+ * One remix source: a `{ upstream_id_hex, commit_hash_hex }` pair naming
1069
+ * an upstream commit this fork derives from. `upstream_id` is the opaque
1070
+ * caller-chosen 32-byte provenance tag (e.g. the room id); `commit_hash`
1071
+ * is the 64-hex id of the upstream commit being remixed.
1072
+ */
1073
+ export class RemixSourceJs {
1074
+ static __wrap(ptr) {
1075
+ const obj = Object.create(RemixSourceJs.prototype);
1076
+ obj.__wbg_ptr = ptr;
1077
+ RemixSourceJsFinalization.register(obj, obj.__wbg_ptr, obj);
1078
+ return obj;
1079
+ }
1080
+ __destroy_into_raw() {
1081
+ const ptr = this.__wbg_ptr;
1082
+ this.__wbg_ptr = 0;
1083
+ RemixSourceJsFinalization.unregister(this);
1084
+ return ptr;
1085
+ }
1086
+ free() {
1087
+ const ptr = this.__destroy_into_raw();
1088
+ wasm.__wbg_remixsourcejs_free(ptr, 0);
1089
+ }
1090
+ /**
1091
+ * @returns {string}
1092
+ */
1093
+ get commit_hash_hex() {
1094
+ let deferred1_0;
1095
+ let deferred1_1;
1096
+ try {
1097
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1098
+ wasm.remixsourcejs_commit_hash_hex(retptr, this.__wbg_ptr);
1099
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1100
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1101
+ deferred1_0 = r0;
1102
+ deferred1_1 = r1;
1103
+ return getStringFromWasm0(r0, r1);
1104
+ } finally {
1105
+ wasm.__wbindgen_add_to_stack_pointer(16);
1106
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1107
+ }
1108
+ }
1109
+ /**
1110
+ * @returns {string}
1111
+ */
1112
+ get upstream_id_hex() {
1113
+ let deferred1_0;
1114
+ let deferred1_1;
1115
+ try {
1116
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1117
+ wasm.remixsourcejs_upstream_id_hex(retptr, this.__wbg_ptr);
1118
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1119
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1120
+ deferred1_0 = r0;
1121
+ deferred1_1 = r1;
1122
+ return getStringFromWasm0(r0, r1);
1123
+ } finally {
1124
+ wasm.__wbindgen_add_to_stack_pointer(16);
1125
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1126
+ }
1127
+ }
1128
+ }
1129
+ if (Symbol.dispose) RemixSourceJs.prototype[Symbol.dispose] = RemixSourceJs.prototype.free;
1130
+
1131
+ /**
1132
+ * A verified KDSP span, including its authenticated metadata and plaintext.
1133
+ *
1134
+ * Both getters use the result of one verification. The JSON deliberately
1135
+ * excludes the bytes; callers obtain them through [`VerifiedSpan::bytes`].
1136
+ */
1137
+ export class VerifiedSpan {
1138
+ static __wrap(ptr) {
1139
+ const obj = Object.create(VerifiedSpan.prototype);
1140
+ obj.__wbg_ptr = ptr;
1141
+ VerifiedSpanFinalization.register(obj, obj.__wbg_ptr, obj);
1142
+ return obj;
1143
+ }
1144
+ __destroy_into_raw() {
1145
+ const ptr = this.__wbg_ptr;
1146
+ this.__wbg_ptr = 0;
1147
+ VerifiedSpanFinalization.unregister(this);
1148
+ return ptr;
1149
+ }
1150
+ free() {
1151
+ const ptr = this.__destroy_into_raw();
1152
+ wasm.__wbg_verifiedspan_free(ptr, 0);
1153
+ }
1154
+ /**
1155
+ * The authenticated content bytes of the requested range.
1156
+ * @returns {Uint8Array}
1157
+ */
1158
+ get bytes() {
1159
+ try {
1160
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1161
+ wasm.verifiedspan_bytes(retptr, this.__wbg_ptr);
1162
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1163
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1164
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1165
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1166
+ return v1;
1167
+ } finally {
1168
+ wasm.__wbindgen_add_to_stack_pointer(16);
1169
+ }
1170
+ }
1171
+ /**
1172
+ * Authenticated span metadata as JSON.
1173
+ * @returns {string}
1174
+ */
1175
+ get json() {
1176
+ let deferred1_0;
1177
+ let deferred1_1;
1178
+ try {
1179
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1180
+ wasm.verifiedspan_json(retptr, this.__wbg_ptr);
1181
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1182
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1183
+ deferred1_0 = r0;
1184
+ deferred1_1 = r1;
1185
+ return getStringFromWasm0(r0, r1);
1186
+ } finally {
1187
+ wasm.__wbindgen_add_to_stack_pointer(16);
1188
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1189
+ }
1190
+ }
1191
+ }
1192
+ if (Symbol.dispose) VerifiedSpan.prototype[Symbol.dispose] = VerifiedSpan.prototype.free;
1193
+
1194
+ /**
1195
+ * Build a DSSE-wrapped in-toto v1 attestation over a subject, signed with the chosen algorithm.
1196
+ *
1197
+ * * `subject_bytes` is the subject's serialised bytes — its `blake3` and
1198
+ * paired `sha256` digest (SPEC-ATTESTATIONS §4.2) are both derived from
1199
+ * these bytes, so the two can never disagree. For a real commit this is
1200
+ * the commit's serialised bytes; callers binding a non-commit subject
1201
+ * (e.g. a derived-key identity binding) pass whatever bytes that
1202
+ * subject's identifier is itself the hash of.
1203
+ * * `predicate_type` is a URI like `https://example.com/Review/v1`.
1204
+ * * `predicate_jcs` is the predicate body as already-canonical JCS bytes (must start with `{` and end with `}`).
1205
+ * * `seed_hex` is a 32-byte seed. How it's interpreted depends on `algo`:
1206
+ * * `ed25519` — raw Ed25519 seed
1207
+ * * `secp256k1` — raw 32-byte scalar
1208
+ * * `p256` — raw 32-byte scalar
1209
+ *
1210
+ * Returns `{ envelope_json, keyid, attestation_id_hex }`. The keyid's prefix reveals which algorithm was used.
1211
+ * @param {Uint8Array} subject_bytes
1212
+ * @param {string} predicate_type
1213
+ * @param {Uint8Array} predicate_jcs
1214
+ * @param {string} seed_hex
1215
+ * @param {string} algo
1216
+ * @returns {AttestationJs}
1217
+ */
1218
+ export function attest_build(subject_bytes, predicate_type, predicate_jcs, seed_hex, algo) {
1219
+ try {
1220
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1221
+ const ptr0 = passArray8ToWasm0(subject_bytes, wasm.__wbindgen_export2);
1222
+ const len0 = WASM_VECTOR_LEN;
1223
+ const ptr1 = passStringToWasm0(predicate_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1224
+ const len1 = WASM_VECTOR_LEN;
1225
+ const ptr2 = passArray8ToWasm0(predicate_jcs, wasm.__wbindgen_export2);
1226
+ const len2 = WASM_VECTOR_LEN;
1227
+ const ptr3 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1228
+ const len3 = WASM_VECTOR_LEN;
1229
+ const ptr4 = passStringToWasm0(algo, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1230
+ const len4 = WASM_VECTOR_LEN;
1231
+ wasm.attest_build(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
1232
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1233
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1234
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1235
+ if (r2) {
1236
+ throw takeObject(r1);
1237
+ }
1238
+ return AttestationJs.__wrap(r0);
1239
+ } finally {
1240
+ wasm.__wbindgen_add_to_stack_pointer(16);
1241
+ }
1242
+ }
1243
+
1244
+ /**
1245
+ * Derive the pubkey + canonical keyid for the given attestation algorithm from a 32-byte seed. `algo` is one of
1246
+ * `"ed25519" | "secp256k1" | "p256"`. Deterministic: same seed + same algorithm always produces the same pubkey.
1247
+ *
1248
+ * Pubkey encoding depends on the algorithm:
1249
+ * * `ed25519` — 32-byte raw pubkey
1250
+ * * `secp256k1` — 33-byte compressed SEC1 (`0x02`/`0x03` prefix + x)
1251
+ * * `p256` — 33-byte compressed SEC1 (same shape)
1252
+ *
1253
+ * `keyid` follows the canonical `<prefix>:<hex-pubkey>` form described in SPEC-ATTESTATIONS §6.3 for ES256K / ES256,
1254
+ * and the legacy `blake3:<hex-of-blake3(pubkey)>` form for Ed25519 (what `RepoKeySigner` emits; verifier accepts).
1255
+ * @param {string} seed_hex
1256
+ * @param {string} algo
1257
+ * @returns {AttestKeyPairJs}
1258
+ */
1259
+ export function attest_keypair(seed_hex, algo) {
1260
+ try {
1261
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1262
+ const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1263
+ const len0 = WASM_VECTOR_LEN;
1264
+ const ptr1 = passStringToWasm0(algo, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1265
+ const len1 = WASM_VECTOR_LEN;
1266
+ wasm.attest_keypair(retptr, ptr0, len0, ptr1, len1);
1267
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1268
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1269
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1270
+ if (r2) {
1271
+ throw takeObject(r1);
1272
+ }
1273
+ return AttestKeyPairJs.__wrap(r0);
1274
+ } finally {
1275
+ wasm.__wbindgen_add_to_stack_pointer(16);
1276
+ }
1277
+ }
1278
+
1279
+ /**
1280
+ * Compute the DSSE PAE for an (unsigned) in-toto attestation over a
1281
+ * subject. This is the exact byte string a browser passkey MUST
1282
+ * place in its `WebAuthn` `challenge` so the resulting assertion
1283
+ * verifies under [`verify_webauthn_wrapping`].
1284
+ *
1285
+ * Same `(subject_bytes, predicate_type, predicate_jcs)` inputs as
1286
+ * [`attest_build`], minus the key — the PAE is signer-independent, so a
1287
+ * passkey and a software key over the same statement bind to identical
1288
+ * bytes. Returns the raw PAE; the JS side passes it straight to
1289
+ * `navigator.credentials.get` as a `BufferSource` challenge.
1290
+ *
1291
+ * NOTE: the `WebAuthn` `challenge` here is the *whole* PAE, and platform
1292
+ * authenticators cap challenge size in practice — keep demo predicates
1293
+ * small (see the research note's "challenge sizing" fork).
1294
+ *
1295
+ * # Errors
1296
+ * The statement fails to encode.
1297
+ * @param {Uint8Array} subject_bytes
1298
+ * @param {string} predicate_type
1299
+ * @param {Uint8Array} predicate_jcs
1300
+ * @returns {Uint8Array}
1301
+ */
1302
+ export function attest_pae(subject_bytes, predicate_type, predicate_jcs) {
1303
+ try {
1304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1305
+ const ptr0 = passArray8ToWasm0(subject_bytes, wasm.__wbindgen_export2);
1306
+ const len0 = WASM_VECTOR_LEN;
1307
+ const ptr1 = passStringToWasm0(predicate_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1308
+ const len1 = WASM_VECTOR_LEN;
1309
+ const ptr2 = passArray8ToWasm0(predicate_jcs, wasm.__wbindgen_export2);
1310
+ const len2 = WASM_VECTOR_LEN;
1311
+ wasm.attest_pae(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
1312
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1313
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1314
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1315
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1316
+ if (r3) {
1317
+ throw takeObject(r2);
1318
+ }
1319
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
1320
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1321
+ return v4;
1322
+ } finally {
1323
+ wasm.__wbindgen_add_to_stack_pointer(16);
1324
+ }
1325
+ }
1326
+
1327
+ /**
1328
+ * Verify a DSSE envelope against a single trust root of the given algorithm.
1329
+ *
1330
+ * * `envelope_json` is the canonical DSSE envelope JSON emitted by [`attest_build`].
1331
+ * * `pubkey_hex` is the public key, hex-encoded:
1332
+ * * `ed25519` — 32-byte raw pubkey (64 hex chars)
1333
+ * * `secp256k1` — 33-byte compressed SEC1 (66 hex chars) or 65-byte uncompressed (130 hex chars)
1334
+ * * `p256` — same shape as `secp256k1`
1335
+ * * `algo` selects which trust-root variant the registry dispatches on.
1336
+ *
1337
+ * Returns `true` iff at least one signature in the envelope verifies.
1338
+ * @param {string} envelope_json
1339
+ * @param {string} pubkey_hex
1340
+ * @param {string} algo
1341
+ * @returns {boolean}
1342
+ */
1343
+ export function attest_verify(envelope_json, pubkey_hex, algo) {
1344
+ const ptr0 = passStringToWasm0(envelope_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1345
+ const len0 = WASM_VECTOR_LEN;
1346
+ const ptr1 = passStringToWasm0(pubkey_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1347
+ const len1 = WASM_VECTOR_LEN;
1348
+ const ptr2 = passStringToWasm0(algo, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1349
+ const len2 = WASM_VECTOR_LEN;
1350
+ const ret = wasm.attest_verify(ptr0, len0, ptr1, len1, ptr2, len2);
1351
+ return ret !== 0;
1352
+ }
1353
+
1354
+ /**
1355
+ * Encode `bytes` in Bao outboard mode and return `{ hash_hex, outboard }`.
1356
+ * Outboard keeps the encoded tree proof separate from the payload so
1357
+ * the demo can stream the original bytes on one track and the proof on
1358
+ * another.
1359
+ * @param {Uint8Array} bytes
1360
+ * @returns {BaoEncoded}
1361
+ */
1362
+ export function bao_encode(bytes) {
1363
+ try {
1364
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1365
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1366
+ const len0 = WASM_VECTOR_LEN;
1367
+ wasm.bao_encode(retptr, ptr0, len0);
1368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1370
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1371
+ if (r2) {
1372
+ throw takeObject(r1);
1373
+ }
1374
+ return BaoEncoded.__wrap(r0);
1375
+ } finally {
1376
+ wasm.__wbindgen_add_to_stack_pointer(16);
1377
+ }
1378
+ }
1379
+
1380
+ /**
1381
+ * Extract a proof-carrying slice from a Bao outboard encoding. The
1382
+ * returned bytes are in the format `bao::decode::SliceDecoder`
1383
+ * consumes — the original payload plus just enough tree proof to
1384
+ * verify it against the root hash.
1385
+ * @param {Uint8Array} outboard
1386
+ * @param {Uint8Array} bytes
1387
+ * @param {number} offset
1388
+ * @param {number} len
1389
+ * @returns {Uint8Array}
1390
+ */
1391
+ export function bao_slice(outboard, bytes, offset, len) {
1392
+ try {
1393
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1394
+ const ptr0 = passArray8ToWasm0(outboard, wasm.__wbindgen_export2);
1395
+ const len0 = WASM_VECTOR_LEN;
1396
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1397
+ const len1 = WASM_VECTOR_LEN;
1398
+ wasm.bao_slice(retptr, ptr0, len0, ptr1, len1, offset, len);
1399
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1400
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1401
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1402
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1403
+ if (r3) {
1404
+ throw takeObject(r2);
1405
+ }
1406
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
1407
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1408
+ return v3;
1409
+ } finally {
1410
+ wasm.__wbindgen_add_to_stack_pointer(16);
1411
+ }
1412
+ }
1413
+
1414
+ /**
1415
+ * Verify a Bao slice against a root hash. On success returns
1416
+ * `{ ok: true, bytes }` with the verified payload. On tamper returns
1417
+ * `{ ok: false, error }` with the error message — a convenience over
1418
+ * throwing, since the demo wants to render both outcomes side-by-side.
1419
+ * @param {string} hash_hex
1420
+ * @param {Uint8Array} slice_bytes
1421
+ * @param {number} offset
1422
+ * @param {number} len
1423
+ * @returns {BaoVerify}
1424
+ */
1425
+ export function bao_verify_slice(hash_hex, slice_bytes, offset, len) {
1426
+ try {
1427
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1428
+ const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1429
+ const len0 = WASM_VECTOR_LEN;
1430
+ const ptr1 = passArray8ToWasm0(slice_bytes, wasm.__wbindgen_export2);
1431
+ const len1 = WASM_VECTOR_LEN;
1432
+ wasm.bao_verify_slice(retptr, ptr0, len0, ptr1, len1, offset, len);
1433
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1434
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1435
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1436
+ if (r2) {
1437
+ throw takeObject(r1);
1438
+ }
1439
+ return BaoVerify.__wrap(r0);
1440
+ } finally {
1441
+ wasm.__wbindgen_add_to_stack_pointer(16);
1442
+ }
1443
+ }
1444
+
1445
+ /**
1446
+ * BLAKE3 of arbitrary bytes, as 64-char lowercase hex. This is the
1447
+ * object id kit uses for every stored object.
1448
+ * @param {Uint8Array} data
1449
+ * @returns {string}
1450
+ */
1451
+ export function blake3_hex(data) {
1452
+ let deferred2_0;
1453
+ let deferred2_1;
1454
+ try {
1455
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1456
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
1457
+ const len0 = WASM_VECTOR_LEN;
1458
+ wasm.blake3_hex(retptr, ptr0, len0);
1459
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1460
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1461
+ deferred2_0 = r0;
1462
+ deferred2_1 = r1;
1463
+ return getStringFromWasm0(r0, r1);
1464
+ } finally {
1465
+ wasm.__wbindgen_add_to_stack_pointer(16);
1466
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
1467
+ }
1468
+ }
1469
+
1470
+ /**
1471
+ * Bao outboard over the **canonical blob bytes** of `content`.
1472
+ *
1473
+ * `hash_hex` equals the blob object id (`object_id(blob_encode(content).bytes)`).
1474
+ * Distinct from [`crate::bao_encode`], which hashes raw file bytes.
1475
+ *
1476
+ * # Errors
1477
+ *
1478
+ * Content larger than 16 MiB, or a serialize failure.
1479
+ * @param {Uint8Array} content
1480
+ * @returns {BaoEncoded}
1481
+ */
1482
+ export function blob_bao_encode(content) {
1483
+ try {
1484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1485
+ const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export2);
1486
+ const len0 = WASM_VECTOR_LEN;
1487
+ wasm.blob_bao_encode(retptr, ptr0, len0);
1488
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1489
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1490
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1491
+ if (r2) {
1492
+ throw takeObject(r1);
1493
+ }
1494
+ return BaoEncoded.__wrap(r0);
1495
+ } finally {
1496
+ wasm.__wbindgen_add_to_stack_pointer(16);
1497
+ }
1498
+ }
1499
+
1500
+ /**
1501
+ * Extract a Bao slice over canonical blob bytes at a **content** offset.
1502
+ *
1503
+ * The +10 shift onto the canonical blob (6-byte prologue + 4-byte
1504
+ * length) happens inside. Distinct from [`crate::bao_slice`].
1505
+ *
1506
+ * # Errors
1507
+ *
1508
+ * Oversize content, serialize failure, or a slice-extract error.
1509
+ * @param {Uint8Array} outboard
1510
+ * @param {Uint8Array} content
1511
+ * @param {number} content_offset
1512
+ * @param {number} len
1513
+ * @returns {Uint8Array}
1514
+ */
1515
+ export function blob_bao_slice(outboard, content, content_offset, len) {
1516
+ try {
1517
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1518
+ const ptr0 = passArray8ToWasm0(outboard, wasm.__wbindgen_export2);
1519
+ const len0 = WASM_VECTOR_LEN;
1520
+ const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_export2);
1521
+ const len1 = WASM_VECTOR_LEN;
1522
+ wasm.blob_bao_slice(retptr, ptr0, len0, ptr1, len1, content_offset, len);
1523
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1524
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1525
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1526
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1527
+ if (r3) {
1528
+ throw takeObject(r2);
1529
+ }
1530
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
1531
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1532
+ return v3;
1533
+ } finally {
1534
+ wasm.__wbindgen_add_to_stack_pointer(16);
1535
+ }
1536
+ }
1537
+
1538
+ /**
1539
+ * Verify a Bao slice against a blob id at a **content** offset.
1540
+ *
1541
+ * Delegates to [`kit_core::verify::verify_blob_slice`]. Tamper returns
1542
+ * `{ ok: false, error }` rather than throwing, matching [`crate::bao_verify_slice`].
1543
+ *
1544
+ * # Errors
1545
+ *
1546
+ * Malformed `blob_id_hex`.
1547
+ * @param {string} blob_id_hex
1548
+ * @param {Uint8Array} slice
1549
+ * @param {number} content_offset
1550
+ * @param {number} len
1551
+ * @returns {BaoVerify}
1552
+ */
1553
+ export function blob_bao_verify_slice(blob_id_hex, slice, content_offset, len) {
1554
+ try {
1555
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1556
+ const ptr0 = passStringToWasm0(blob_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1557
+ const len0 = WASM_VECTOR_LEN;
1558
+ const ptr1 = passArray8ToWasm0(slice, wasm.__wbindgen_export2);
1559
+ const len1 = WASM_VECTOR_LEN;
1560
+ wasm.blob_bao_verify_slice(retptr, ptr0, len0, ptr1, len1, content_offset, len);
1561
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1562
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1563
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1564
+ if (r2) {
1565
+ throw takeObject(r1);
1566
+ }
1567
+ return BaoVerify.__wrap(r0);
1568
+ } finally {
1569
+ wasm.__wbindgen_add_to_stack_pointer(16);
1570
+ }
1571
+ }
1572
+
1573
+ /**
1574
+ * Decode a canonical blob into its uninterpreted file bytes.
1575
+ *
1576
+ * # Errors
1577
+ * Invalid encoding, a non-blob object, or input larger than 16 MiB.
1578
+ * @param {Uint8Array} bytes
1579
+ * @returns {Uint8Array}
1580
+ */
1581
+ export function blob_decode(bytes) {
1582
+ try {
1583
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1584
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1585
+ const len0 = WASM_VECTOR_LEN;
1586
+ wasm.blob_decode(retptr, ptr0, len0);
1587
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1588
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1589
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1590
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1591
+ if (r3) {
1592
+ throw takeObject(r2);
1593
+ }
1594
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
1595
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1596
+ return v2;
1597
+ } finally {
1598
+ wasm.__wbindgen_add_to_stack_pointer(16);
1599
+ }
1600
+ }
1601
+
1602
+ /**
1603
+ * Serialize a blob object and return `{ bytes, hash_hex }`.
1604
+ *
1605
+ * The returned `bytes` are the canonical on-disk v1 object bytes
1606
+ * (see `docs/specs/SPEC-OBJECTS.md`); `hash_hex` is the object's content id
1607
+ * (via `id_from_object`) — for a non-merkelized `Blob`, BLAKE3 of those bytes.
1608
+ * @param {Uint8Array} data
1609
+ * @returns {EncodedObject}
1610
+ */
1611
+ export function blob_encode(data) {
1612
+ try {
1613
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1614
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
1615
+ const len0 = WASM_VECTOR_LEN;
1616
+ wasm.blob_encode(retptr, ptr0, len0);
1617
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1618
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1619
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1620
+ if (r2) {
1621
+ throw takeObject(r1);
1622
+ }
1623
+ return EncodedObject.__wrap(r0);
1624
+ } finally {
1625
+ wasm.__wbindgen_add_to_stack_pointer(16);
1626
+ }
1627
+ }
1628
+
1629
+ /**
1630
+ * Run the frozen v1 `FastCDC` chunker over `bytes` and return
1631
+ * `{ chunks: [{ offset, len, hash_hex }], avg, min, max }`.
1632
+ *
1633
+ * Each `hash_hex` is BLAKE3 of the chunk payload — handy for colouring
1634
+ * chips in the web demo when an edit shifts boundaries.
1635
+ * @param {Uint8Array} bytes
1636
+ * @returns {ChunkerResult}
1637
+ */
1638
+ export function chunk_boundaries(bytes) {
1639
+ try {
1640
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1641
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1642
+ const len0 = WASM_VECTOR_LEN;
1643
+ wasm.chunk_boundaries(retptr, ptr0, len0);
1644
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1645
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1646
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1647
+ if (r2) {
1648
+ throw takeObject(r1);
1649
+ }
1650
+ return ChunkerResult.__wrap(r0);
1651
+ } finally {
1652
+ wasm.__wbindgen_add_to_stack_pointer(16);
1653
+ }
1654
+ }
1655
+
1656
+ /**
1657
+ * Decode a canonical `ChunkedBlob` object into JSON
1658
+ * `{ total_size, chunk_size, chunks: [hex] }`.
1659
+ *
1660
+ * Input is capped at 16 MiB, matching [`crate::chunked_blob_encode`]'s
1661
+ * workspace admission limit.
1662
+ *
1663
+ * # Errors
1664
+ *
1665
+ * Oversize input, invalid encoding, or a non-`ChunkedBlob` object.
1666
+ * @param {Uint8Array} bytes
1667
+ * @returns {string}
1668
+ */
1669
+ export function chunked_blob_decode(bytes) {
1670
+ let deferred3_0;
1671
+ let deferred3_1;
1672
+ try {
1673
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1674
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1675
+ const len0 = WASM_VECTOR_LEN;
1676
+ wasm.chunked_blob_decode(retptr, ptr0, len0);
1677
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1678
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1679
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1680
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1681
+ var ptr2 = r0;
1682
+ var len2 = r1;
1683
+ if (r3) {
1684
+ ptr2 = 0; len2 = 0;
1685
+ throw takeObject(r2);
1686
+ }
1687
+ deferred3_0 = ptr2;
1688
+ deferred3_1 = len2;
1689
+ return getStringFromWasm0(ptr2, len2);
1690
+ } finally {
1691
+ wasm.__wbindgen_add_to_stack_pointer(16);
1692
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1693
+ }
1694
+ }
1695
+
1696
+ /**
1697
+ * Build a `ChunkedBlob` manifest from raw bytes: chunk with `FastCDC` v1 and
1698
+ * return `{ root_hash_hex, chunks: [{ offset, len, hash_hex }], bytes_len }`.
1699
+ *
1700
+ * `root_hash_hex` is the object's content id — the BMT root of the manifest,
1701
+ * whose leaves are the per-chunk **Blob object ids** (built via the shared
1702
+ * `worktree::chunked_blob_from_bytes`), so it equals the id the native store
1703
+ * keys the `ChunkedBlob` under. Each chunk's `hash_hex` is the **raw**
1704
+ * BLAKE3 of the chunk payload — for UI colouring/dedup, distinct from the
1705
+ * manifest leaf. `chunk_size` is `0` (the CDC marker, SPEC-OBJECTS §13.7).
1706
+ * @param {Uint8Array} bytes
1707
+ * @returns {ChunkedBlobJs}
1708
+ */
1709
+ export function chunked_blob_encode(bytes) {
1710
+ try {
1711
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1712
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1713
+ const len0 = WASM_VECTOR_LEN;
1714
+ wasm.chunked_blob_encode(retptr, ptr0, len0);
1715
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1716
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1717
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1718
+ if (r2) {
1719
+ throw takeObject(r1);
1720
+ }
1721
+ return ChunkedBlobJs.__wrap(r0);
1722
+ } finally {
1723
+ wasm.__wbindgen_add_to_stack_pointer(16);
1724
+ }
1725
+ }
1726
+
1727
+ /**
1728
+ * Decode a commit object's display fields from its raw on-disk bytes.
1729
+ *
1730
+ * Deserializes via the same path [`commit_verify`] uses
1731
+ * (`kit_core::deserialize` → [`Object::Commit`]) and exposes the
1732
+ * fields the multiplayer log needs to walk + render the room's `main`
1733
+ * chain: the [`CommitInfoJs::message`], the parents via
1734
+ * [`CommitInfoJs::parent_count`] / [`CommitInfoJs::parent`]
1735
+ * (64-hex object ids, parent 0 first), the
1736
+ * [`CommitInfoJs::signer_hex`] (the 64-hex Ed25519 signer/author
1737
+ * pubkey), the [`CommitInfoJs::timestamp`] (unix seconds), the
1738
+ * [`CommitInfoJs::tree_hex`] (64-hex tree object id), and the
1739
+ * [`CommitInfoJs::signature_hex`] (128-hex Ed25519 signature) — the
1740
+ * last two power the navigable commit-detail view.
1741
+ *
1742
+ * This function does not verify the signature. The signer, tree and
1743
+ * signature fields are unverified claims. Call [`commit_verify`] to check
1744
+ * them. Input over 16 MiB is rejected.
1745
+ *
1746
+ * # Errors
1747
+ * `commit_bytes` is not a valid serialized object, or it deserializes
1748
+ * to a non-`Commit` object.
1749
+ * @param {Uint8Array} bytes
1750
+ * @returns {CommitInfoJs}
1751
+ */
1752
+ export function commit_decode(bytes) {
1753
+ try {
1754
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1755
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
1756
+ const len0 = WASM_VECTOR_LEN;
1757
+ wasm.commit_decode(retptr, ptr0, len0);
1758
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1759
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1760
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1761
+ if (r2) {
1762
+ throw takeObject(r1);
1763
+ }
1764
+ return CommitInfoJs.__wrap(r0);
1765
+ } finally {
1766
+ wasm.__wbindgen_add_to_stack_pointer(16);
1767
+ }
1768
+ }
1769
+
1770
+ /**
1771
+ * Build and sign a commit, returning `{ bytes, hash_hex, signature_hex }`.
1772
+ *
1773
+ * `parent_hex` is a comma-separated list of parent commit hashes (empty
1774
+ * string = root commit). `seed_hex` is the 32-byte Ed25519 seed.
1775
+ * @param {string} tree_hash_hex
1776
+ * @param {string} parent_hex
1777
+ * @param {string} message
1778
+ * @param {bigint} timestamp
1779
+ * @param {string} seed_hex
1780
+ * @returns {EncodedCommit}
1781
+ */
1782
+ export function commit_encode_and_sign(tree_hash_hex, parent_hex, message, timestamp, seed_hex) {
1783
+ try {
1784
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1785
+ const ptr0 = passStringToWasm0(tree_hash_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1786
+ const len0 = WASM_VECTOR_LEN;
1787
+ const ptr1 = passStringToWasm0(parent_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1788
+ const len1 = WASM_VECTOR_LEN;
1789
+ const ptr2 = passStringToWasm0(message, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1790
+ const len2 = WASM_VECTOR_LEN;
1791
+ const ptr3 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1792
+ const len3 = WASM_VECTOR_LEN;
1793
+ wasm.commit_encode_and_sign(retptr, ptr0, len0, ptr1, len1, ptr2, len2, timestamp, ptr3, len3);
1794
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1795
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1796
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1797
+ if (r2) {
1798
+ throw takeObject(r1);
1799
+ }
1800
+ return EncodedCommit.__wrap(r0);
1801
+ } finally {
1802
+ wasm.__wbindgen_add_to_stack_pointer(16);
1803
+ }
1804
+ }
1805
+
1806
+ /**
1807
+ * Verify a commit signature, given the raw on-disk commit bytes.
1808
+ * Returns `true` on pass, `false` on structural or crypto failure.
1809
+ * Input over 16 MiB returns `false`.
1810
+ * @param {Uint8Array} commit_bytes
1811
+ * @returns {boolean}
1812
+ */
1813
+ export function commit_verify(commit_bytes) {
1814
+ const ptr0 = passArray8ToWasm0(commit_bytes, wasm.__wbindgen_export2);
1815
+ const len0 = WASM_VECTOR_LEN;
1816
+ const ret = wasm.commit_verify(ptr0, len0);
1817
+ return ret !== 0;
1818
+ }
1819
+
1820
+ /**
1821
+ * Build a SPEC-DELTA v1 stream of `base -> target` and return a
1822
+ * structural summary: `{ ops, bytes_on_wire, full_size }`.
1823
+ *
1824
+ * `ops` contains one entry per opcode — `{ kind: "copy", offset, len }`
1825
+ * or `{ kind: "insert", len }` — without the insert payloads, so the
1826
+ * whole thing stays cheap to pass across the JS boundary. `bytes_on_wire`
1827
+ * is the total delta stream length; `full_size` is `target.len()` for
1828
+ * easy delta-savings calculation.
1829
+ * @param {Uint8Array} base
1830
+ * @param {Uint8Array} target
1831
+ * @returns {DeltaSummary}
1832
+ */
1833
+ export function delta_encode(base, target) {
1834
+ try {
1835
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1836
+ const ptr0 = passArray8ToWasm0(base, wasm.__wbindgen_export2);
1837
+ const len0 = WASM_VECTOR_LEN;
1838
+ const ptr1 = passArray8ToWasm0(target, wasm.__wbindgen_export2);
1839
+ const len1 = WASM_VECTOR_LEN;
1840
+ wasm.delta_encode(retptr, ptr0, len0, ptr1, len1);
1841
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1842
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1843
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1844
+ if (r2) {
1845
+ throw takeObject(r1);
1846
+ }
1847
+ return DeltaSummary.__wrap(r0);
1848
+ } finally {
1849
+ wasm.__wbindgen_add_to_stack_pointer(16);
1850
+ }
1851
+ }
1852
+
1853
+ /**
1854
+ * Return the verified payload bytes of a disclosure bundle.
1855
+ *
1856
+ * Re-verifies the bundle. Object payload: canonical object bytes. Chunk
1857
+ * payload: the chunk's canonical blob bytes. Range payload: the
1858
+ * disclosed range bytes.
1859
+ *
1860
+ * # Errors
1861
+ *
1862
+ * The same failures as [`verify_disclosure`].
1863
+ * @param {string} commit_id_hex
1864
+ * @param {Uint8Array} bundle
1865
+ * @returns {Uint8Array}
1866
+ */
1867
+ export function disclosure_payload_bytes(commit_id_hex, bundle) {
1868
+ try {
1869
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1870
+ const ptr0 = passStringToWasm0(commit_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1871
+ const len0 = WASM_VECTOR_LEN;
1872
+ const ptr1 = passArray8ToWasm0(bundle, wasm.__wbindgen_export2);
1873
+ const len1 = WASM_VECTOR_LEN;
1874
+ wasm.disclosure_payload_bytes(retptr, ptr0, len0, ptr1, len1);
1875
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1876
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1877
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1878
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1879
+ if (r3) {
1880
+ throw takeObject(r2);
1881
+ }
1882
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
1883
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1884
+ return v3;
1885
+ } finally {
1886
+ wasm.__wbindgen_add_to_stack_pointer(16);
1887
+ }
1888
+ }
1889
+
1890
+ /**
1891
+ * Derive the 32-byte Ed25519 public key from a 32-byte seed.
1892
+ *
1893
+ * Pure function: same seed → same pubkey. Errors only if `seed` is not
1894
+ * exactly 32 bytes. Internally goes through `kit-core`'s
1895
+ * `KeyPair::from_seed`, which is the same derivation step the commit
1896
+ * signer uses, so a key minted here interoperates 1:1 with on-disk
1897
+ * `.kit/keys/default.key` material.
1898
+ * @param {Uint8Array} seed
1899
+ * @returns {Uint8Array}
1900
+ */
1901
+ export function ed25519_pubkey_from_seed(seed) {
1902
+ try {
1903
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1904
+ const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_export2);
1905
+ const len0 = WASM_VECTOR_LEN;
1906
+ wasm.ed25519_pubkey_from_seed(retptr, ptr0, len0);
1907
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1908
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1909
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1910
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1911
+ if (r3) {
1912
+ throw takeObject(r2);
1913
+ }
1914
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
1915
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1916
+ return v2;
1917
+ } finally {
1918
+ wasm.__wbindgen_add_to_stack_pointer(16);
1919
+ }
1920
+ }
1921
+
1922
+ /**
1923
+ * Sign `msg` with the Ed25519 secret derived from a 32-byte `seed`.
1924
+ *
1925
+ * Returns the 64-byte signature (`R || s`). Errors only if `seed` is
1926
+ * not exactly 32 bytes — Ed25519 signing itself is infallible once the
1927
+ * key material is the right shape (RFC 8032 is deterministic; no RNG).
1928
+ *
1929
+ * The output is byte-equal to
1930
+ * `ed25519_dalek::SigningKey::from_bytes(seed).sign(msg)`, which is the
1931
+ * same signing path `kit-core::sign::KeyPair` drives for commit
1932
+ * signatures (modulo the BLAKE3-domain wrapper that commits add on
1933
+ * top — those callers should keep using `commit_encode_and_sign`).
1934
+ * @param {Uint8Array} msg
1935
+ * @param {Uint8Array} seed
1936
+ * @returns {Uint8Array}
1937
+ */
1938
+ export function ed25519_sign(msg, seed) {
1939
+ try {
1940
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1941
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_export2);
1942
+ const len0 = WASM_VECTOR_LEN;
1943
+ const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_export2);
1944
+ const len1 = WASM_VECTOR_LEN;
1945
+ wasm.ed25519_sign(retptr, ptr0, len0, ptr1, len1);
1946
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1947
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1948
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1949
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1950
+ if (r3) {
1951
+ throw takeObject(r2);
1952
+ }
1953
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
1954
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1955
+ return v3;
1956
+ } finally {
1957
+ wasm.__wbindgen_add_to_stack_pointer(16);
1958
+ }
1959
+ }
1960
+
1961
+ /**
1962
+ * Verify a raw Ed25519 signature, with strict canonical-encoding checks.
1963
+ *
1964
+ * Returns `true` only if the signature passes the SPEC-SIGNING §1
1965
+ * predicate over `msg`: canonical, non-small-order `A` and `R`, canonical
1966
+ * `s`, and the cofactored equation. This is the same check every other
1967
+ * Ed25519 verifier in kit runs.
1968
+ *
1969
+ * Wrong-length `sig` or `pubkey` return `false` (the JS API matches the
1970
+ * noble shape — boolean out, no exceptions on shape errors).
1971
+ * @param {Uint8Array} sig
1972
+ * @param {Uint8Array} msg
1973
+ * @param {Uint8Array} pubkey
1974
+ * @returns {boolean}
1975
+ */
1976
+ export function ed25519_verify(sig, msg, pubkey) {
1977
+ const ptr0 = passArray8ToWasm0(sig, wasm.__wbindgen_export2);
1978
+ const len0 = WASM_VECTOR_LEN;
1979
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export2);
1980
+ const len1 = WASM_VECTOR_LEN;
1981
+ const ptr2 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export2);
1982
+ const len2 = WASM_VECTOR_LEN;
1983
+ const ret = wasm.ed25519_verify(ptr0, len0, ptr1, len1, ptr2, len2);
1984
+ return ret !== 0;
1985
+ }
1986
+
1987
+ /**
1988
+ * Derive `{ seed_hex, pubkey_hex }` from a 32-byte seed. Deterministic:
1989
+ * the same seed always yields the same public key.
1990
+ * @param {string} seed_hex
1991
+ * @returns {KeyPairJs}
1992
+ */
1993
+ export function keypair_from_seed(seed_hex) {
1994
+ try {
1995
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1996
+ const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
1997
+ const len0 = WASM_VECTOR_LEN;
1998
+ wasm.keypair_from_seed(retptr, ptr0, len0);
1999
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2000
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2001
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2002
+ if (r2) {
2003
+ throw takeObject(r1);
2004
+ }
2005
+ return KeyPairJs.__wrap(r0);
2006
+ } finally {
2007
+ wasm.__wbindgen_add_to_stack_pointer(16);
2008
+ }
2009
+ }
2010
+
2011
+ /**
2012
+ * Generate a fresh Ed25519 keypair from the browser CSPRNG.
2013
+ * @returns {KeyPairJs}
2014
+ */
2015
+ export function keypair_generate() {
2016
+ try {
2017
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2018
+ wasm.keypair_generate(retptr);
2019
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2020
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2021
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2022
+ if (r2) {
2023
+ throw takeObject(r1);
2024
+ }
2025
+ return KeyPairJs.__wrap(r0);
2026
+ } finally {
2027
+ wasm.__wbindgen_add_to_stack_pointer(16);
2028
+ }
2029
+ }
2030
+
2031
+ /**
2032
+ * Return a canonical object's 64-hex content id, including Merkle ids.
2033
+ *
2034
+ * This checks the encoding, not signatures or referenced child objects.
2035
+ * Callers must compare the result with the independently requested id.
2036
+ *
2037
+ * # Errors
2038
+ * Invalid object encoding or input larger than 16 MiB.
2039
+ * @param {Uint8Array} bytes
2040
+ * @returns {string}
2041
+ */
2042
+ export function object_id(bytes) {
2043
+ let deferred3_0;
2044
+ let deferred3_1;
2045
+ try {
2046
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2047
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2048
+ const len0 = WASM_VECTOR_LEN;
2049
+ wasm.object_id(retptr, ptr0, len0);
2050
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2051
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2052
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2053
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2054
+ var ptr2 = r0;
2055
+ var len2 = r1;
2056
+ if (r3) {
2057
+ ptr2 = 0; len2 = 0;
2058
+ throw takeObject(r2);
2059
+ }
2060
+ deferred3_0 = ptr2;
2061
+ deferred3_1 = len2;
2062
+ return getStringFromWasm0(ptr2, len2);
2063
+ } finally {
2064
+ wasm.__wbindgen_add_to_stack_pointer(16);
2065
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
2066
+ }
2067
+ }
2068
+
2069
+ /**
2070
+ * Read the object-type tag from a serialized object's prologue and
2071
+ * return its spec short name: `"commit" | "remix" | "tree" | "blob" |
2072
+ * "chunked_blob" | "delta" | "tag"`.
2073
+ *
2074
+ * Lets the browser route a fetched object to the right decoder
2075
+ * (`commit_decode` vs `remix_decode`) without guessing or trial-decoding.
2076
+ * Goes through `kit_core::deserialize` so the answer reflects a fully
2077
+ * well-formed object, then reports `ObjectType::name`.
2078
+ *
2079
+ * # Errors
2080
+ * `bytes` is not a valid serialized object (bad prologue / truncated /
2081
+ * unknown type tag), or longer than 16 MiB.
2082
+ * @param {Uint8Array} bytes
2083
+ * @returns {string}
2084
+ */
2085
+ export function object_kind(bytes) {
2086
+ let deferred3_0;
2087
+ let deferred3_1;
2088
+ try {
2089
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2090
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2091
+ const len0 = WASM_VECTOR_LEN;
2092
+ wasm.object_kind(retptr, ptr0, len0);
2093
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2094
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2095
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2096
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2097
+ var ptr2 = r0;
2098
+ var len2 = r1;
2099
+ if (r3) {
2100
+ ptr2 = 0; len2 = 0;
2101
+ throw takeObject(r2);
2102
+ }
2103
+ deferred3_0 = ptr2;
2104
+ deferred3_1 = len2;
2105
+ return getStringFromWasm0(ptr2, len2);
2106
+ } finally {
2107
+ wasm.__wbindgen_add_to_stack_pointer(16);
2108
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
2109
+ }
2110
+ }
2111
+
2112
+ /**
2113
+ * Decode a remix object's display fields from its raw on-disk bytes.
2114
+ *
2115
+ * The remix counterpart of [`commit_decode`]: deserializes via
2116
+ * `kit_core::deserialize` → [`Object::Remix`] and exposes the same
2117
+ * commit-shaped fields (`message`, `signer_hex`, `timestamp`,
2118
+ * `tree_hex`, `signature_hex`, `parents`) plus the remix-only
2119
+ * `sources` — each a `{ upstream_id_hex, commit_hash_hex }`
2120
+ * read by `source_count` + the `source(i)` indexed getter. The web
2121
+ * browser uses the sources to render the "fork of …" badge whose
2122
+ * `commit_hash` links to the upstream commit's detail.
2123
+ *
2124
+ * This function does not verify the signature. The signer, tree and
2125
+ * signature fields are unverified claims. Input over 16 MiB is rejected.
2126
+ *
2127
+ * # Errors
2128
+ * `bytes` is not a valid serialized object, or it deserializes to a
2129
+ * non-`Remix` object.
2130
+ * @param {Uint8Array} bytes
2131
+ * @returns {RemixInfoJs}
2132
+ */
2133
+ export function remix_decode(bytes) {
2134
+ try {
2135
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2136
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2137
+ const len0 = WASM_VECTOR_LEN;
2138
+ wasm.remix_decode(retptr, ptr0, len0);
2139
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2140
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2141
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2142
+ if (r2) {
2143
+ throw takeObject(r1);
2144
+ }
2145
+ return RemixInfoJs.__wrap(r0);
2146
+ } finally {
2147
+ wasm.__wbindgen_add_to_stack_pointer(16);
2148
+ }
2149
+ }
2150
+
2151
+ /**
2152
+ * Build and sign a remix (fork/derivation), returning
2153
+ * `{ bytes, hash_hex, signature_hex }` like [`commit_encode_and_sign`].
2154
+ *
2155
+ * A `Remix` is the first-class fork object: it snapshots a `tree_hash`,
2156
+ * names zero or more `parents` (prior remixes/commits in the fork's own
2157
+ * history), and — crucially — records one or more `sources`, each a
2158
+ * `RemixSource { upstream_id, commit_hash }` pointing at the upstream
2159
+ * commit(s) this fork derives from.
2160
+ *
2161
+ * Inputs mirror the commit variant, plus `sources_json`:
2162
+ * * `tree_hash_hex` — 64-hex tree object id this remix snapshots.
2163
+ * * `parent_hex` — comma-separated parent ids (empty = root remix).
2164
+ * * `sources_json` — JSON array of `{ "upstream_id_hex", "commit_hash_hex" }`
2165
+ * objects, each 64-hex. The upstream commits being forked/remixed.
2166
+ * * `message` / `timestamp` — same as a commit.
2167
+ * * `seed_hex` — the 32-byte Ed25519 seed.
2168
+ *
2169
+ * `sources` are sorted here by `(upstream_id, commit_hash)` and checked
2170
+ * for duplicates, satisfying the strict-ascending order kit-core's
2171
+ * `read_remix` enforces at decode time (see `Remix::sources_sorted`).
2172
+ * At least one source is required — a remix with no source is not a fork.
2173
+ *
2174
+ * # Errors
2175
+ * Any hex field is malformed, `sources_json` does not parse, `sources`
2176
+ * is empty or contains a duplicate `(upstream_id, commit_hash)` pair, or
2177
+ * signing-bytes construction fails.
2178
+ * @param {string} tree_hash_hex
2179
+ * @param {string} parent_hex
2180
+ * @param {string} sources_json
2181
+ * @param {string} message
2182
+ * @param {bigint} timestamp
2183
+ * @param {string} seed_hex
2184
+ * @returns {EncodedCommit}
2185
+ */
2186
+ export function remix_encode_and_sign(tree_hash_hex, parent_hex, sources_json, message, timestamp, seed_hex) {
2187
+ try {
2188
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2189
+ const ptr0 = passStringToWasm0(tree_hash_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2190
+ const len0 = WASM_VECTOR_LEN;
2191
+ const ptr1 = passStringToWasm0(parent_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2192
+ const len1 = WASM_VECTOR_LEN;
2193
+ const ptr2 = passStringToWasm0(sources_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2194
+ const len2 = WASM_VECTOR_LEN;
2195
+ const ptr3 = passStringToWasm0(message, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2196
+ const len3 = WASM_VECTOR_LEN;
2197
+ const ptr4 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2198
+ const len4 = WASM_VECTOR_LEN;
2199
+ wasm.remix_encode_and_sign(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, timestamp, ptr4, len4);
2200
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2201
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2202
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2203
+ if (r2) {
2204
+ throw takeObject(r1);
2205
+ }
2206
+ return EncodedCommit.__wrap(r0);
2207
+ } finally {
2208
+ wasm.__wbindgen_add_to_stack_pointer(16);
2209
+ }
2210
+ }
2211
+
2212
+ /**
2213
+ * Verify a canonical remix's signature. Returns false for invalid encoding,
2214
+ * wrong object kind, signature failure, or input larger than 16 MiB.
2215
+ * @param {Uint8Array} bytes
2216
+ * @returns {boolean}
2217
+ */
2218
+ export function remix_verify(bytes) {
2219
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2220
+ const len0 = WASM_VECTOR_LEN;
2221
+ const ret = wasm.remix_verify(ptr0, len0);
2222
+ return ret !== 0;
2223
+ }
2224
+
2225
+ /**
2226
+ * Sign arbitrary bytes under kit's commit signing domain. Exposed for
2227
+ * the signing demo — real kit commits go through `commit_encode_and_sign`.
2228
+ * @param {string} seed_hex
2229
+ * @param {Uint8Array} bytes
2230
+ * @returns {string}
2231
+ */
2232
+ export function sign_bytes_commit_domain(seed_hex, bytes) {
2233
+ let deferred4_0;
2234
+ let deferred4_1;
2235
+ try {
2236
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2237
+ const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2238
+ const len0 = WASM_VECTOR_LEN;
2239
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2240
+ const len1 = WASM_VECTOR_LEN;
2241
+ wasm.sign_bytes_commit_domain(retptr, ptr0, len0, ptr1, len1);
2242
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2243
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2244
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2245
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2246
+ var ptr3 = r0;
2247
+ var len3 = r1;
2248
+ if (r3) {
2249
+ ptr3 = 0; len3 = 0;
2250
+ throw takeObject(r2);
2251
+ }
2252
+ deferred4_0 = ptr3;
2253
+ deferred4_1 = len3;
2254
+ return getStringFromWasm0(ptr3, len3);
2255
+ } finally {
2256
+ wasm.__wbindgen_add_to_stack_pointer(16);
2257
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
2258
+ }
2259
+ }
2260
+
2261
+ /**
2262
+ * Decode a canonical tree into JSON `[name, mode, hash_hex]` triples.
2263
+ * Modes match [`tree_encode`]: `blob`, `tree`, `symlink`, and `exec`.
2264
+ *
2265
+ * # Errors
2266
+ * Invalid encoding, a non-tree object, input larger than 16 MiB, or a
2267
+ * non-UTF-8 entry name (which cannot round-trip through the JSON API).
2268
+ * @param {Uint8Array} bytes
2269
+ * @returns {string}
2270
+ */
2271
+ export function tree_decode(bytes) {
2272
+ let deferred3_0;
2273
+ let deferred3_1;
2274
+ try {
2275
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2276
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2277
+ const len0 = WASM_VECTOR_LEN;
2278
+ wasm.tree_decode(retptr, ptr0, len0);
2279
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2280
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2281
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2282
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2283
+ var ptr2 = r0;
2284
+ var len2 = r1;
2285
+ if (r3) {
2286
+ ptr2 = 0; len2 = 0;
2287
+ throw takeObject(r2);
2288
+ }
2289
+ deferred3_0 = ptr2;
2290
+ deferred3_1 = len2;
2291
+ return getStringFromWasm0(ptr2, len2);
2292
+ } finally {
2293
+ wasm.__wbindgen_add_to_stack_pointer(16);
2294
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
2295
+ }
2296
+ }
2297
+
2298
+ /**
2299
+ * Build a tree object from a JSON array of `[name, mode, hash_hex]`
2300
+ * triples and return its serialized bytes + hash. `mode` is one of
2301
+ * `"blob" | "tree" | "symlink" | "exec"`.
2302
+ * @param {string} entries_json
2303
+ * @returns {EncodedObject}
2304
+ */
2305
+ export function tree_encode(entries_json) {
2306
+ try {
2307
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2308
+ const ptr0 = passStringToWasm0(entries_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2309
+ const len0 = WASM_VECTOR_LEN;
2310
+ wasm.tree_encode(retptr, ptr0, len0);
2311
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2312
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2313
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2314
+ if (r2) {
2315
+ throw takeObject(r1);
2316
+ }
2317
+ return EncodedObject.__wrap(r0);
2318
+ } finally {
2319
+ wasm.__wbindgen_add_to_stack_pointer(16);
2320
+ }
2321
+ }
2322
+
2323
+ /**
2324
+ * Verify a signature made by [`sign_bytes_commit_domain`].
2325
+ * @param {string} pubkey_hex
2326
+ * @param {Uint8Array} bytes
2327
+ * @param {string} sig_hex
2328
+ * @returns {boolean}
2329
+ */
2330
+ export function verify_bytes_commit_domain(pubkey_hex, bytes, sig_hex) {
2331
+ const ptr0 = passStringToWasm0(pubkey_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2332
+ const len0 = WASM_VECTOR_LEN;
2333
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
2334
+ const len1 = WASM_VECTOR_LEN;
2335
+ const ptr2 = passStringToWasm0(sig_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2336
+ const len2 = WASM_VECTOR_LEN;
2337
+ const ret = wasm.verify_bytes_commit_domain(ptr0, len0, ptr1, len1, ptr2, len2);
2338
+ return ret !== 0;
2339
+ }
2340
+
2341
+ /**
2342
+ * Verify a single chunk inclusion proof against a `ChunkedBlob` id.
2343
+ *
2344
+ * `position` is the BMT position (chunk index + 1). Position 0 is the
2345
+ * metadata leaf and is never a valid chunk proof. Returns `Ok(false)`
2346
+ * on [`MerkleError::VerificationFailed`]; `Err` on malformed input.
2347
+ *
2348
+ * # Errors
2349
+ *
2350
+ * Malformed hex or proof bytes, or any merkle error other than
2351
+ * [`MerkleError::VerificationFailed`].
2352
+ * @param {string} chunked_id_hex
2353
+ * @param {string} chunk_id_hex
2354
+ * @param {number} position
2355
+ * @param {Uint8Array} proof
2356
+ * @returns {boolean}
2357
+ */
2358
+ export function verify_chunk(chunked_id_hex, chunk_id_hex, position, proof) {
2359
+ try {
2360
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2361
+ const ptr0 = passStringToWasm0(chunked_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2362
+ const len0 = WASM_VECTOR_LEN;
2363
+ const ptr1 = passStringToWasm0(chunk_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2364
+ const len1 = WASM_VECTOR_LEN;
2365
+ const ptr2 = passArray8ToWasm0(proof, wasm.__wbindgen_export2);
2366
+ const len2 = WASM_VECTOR_LEN;
2367
+ wasm.verify_chunk(retptr, ptr0, len0, ptr1, len1, position, ptr2, len2);
2368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2370
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2371
+ if (r2) {
2372
+ throw takeObject(r1);
2373
+ }
2374
+ return r0 !== 0;
2375
+ } finally {
2376
+ wasm.__wbindgen_add_to_stack_pointer(16);
2377
+ }
2378
+ }
2379
+
2380
+ /**
2381
+ * Verify a closure manifest plus concatenated packs against a trusted root.
2382
+ *
2383
+ * The manifest is a locator, never a trust anchor: `expected_root_hex`
2384
+ * must match the manifest root. Pack framing matches
2385
+ * [`verify_closure_packs`].
2386
+ *
2387
+ * # Errors
2388
+ *
2389
+ * Malformed hex, oversize input, or any [`verify::VerifyError`].
2390
+ * @param {string} expected_root_hex
2391
+ * @param {Uint8Array} manifest
2392
+ * @param {Uint8Array} packs
2393
+ * @param {string} pack_lengths_json
2394
+ * @returns {string}
2395
+ */
2396
+ export function verify_closure_manifest(expected_root_hex, manifest, packs, pack_lengths_json) {
2397
+ let deferred6_0;
2398
+ let deferred6_1;
2399
+ try {
2400
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2401
+ const ptr0 = passStringToWasm0(expected_root_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2402
+ const len0 = WASM_VECTOR_LEN;
2403
+ const ptr1 = passArray8ToWasm0(manifest, wasm.__wbindgen_export2);
2404
+ const len1 = WASM_VECTOR_LEN;
2405
+ const ptr2 = passArray8ToWasm0(packs, wasm.__wbindgen_export2);
2406
+ const len2 = WASM_VECTOR_LEN;
2407
+ const ptr3 = passStringToWasm0(pack_lengths_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2408
+ const len3 = WASM_VECTOR_LEN;
2409
+ wasm.verify_closure_manifest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
2410
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2411
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2412
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2413
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2414
+ var ptr5 = r0;
2415
+ var len5 = r1;
2416
+ if (r3) {
2417
+ ptr5 = 0; len5 = 0;
2418
+ throw takeObject(r2);
2419
+ }
2420
+ deferred6_0 = ptr5;
2421
+ deferred6_1 = len5;
2422
+ return getStringFromWasm0(ptr5, len5);
2423
+ } finally {
2424
+ wasm.__wbindgen_add_to_stack_pointer(16);
2425
+ wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
2426
+ }
2427
+ }
2428
+
2429
+ /**
2430
+ * Verify concatenated raw-only closure packs against a trusted root.
2431
+ *
2432
+ * `mode` is `"snapshot"` or `"history"`. `packs` is the concatenation of
2433
+ * each pack's bytes; `pack_lengths_json` is a JSON array of those
2434
+ * lengths in the same order, e.g. `"[1024,2048]"`. Each pack and the
2435
+ * concatenated buffer are capped at 1 GiB.
2436
+ *
2437
+ * Returns JSON `{ root, mode, verified, complete, unreferenced_checked,
2438
+ * missing, corrupt, unreferenced }`.
2439
+ *
2440
+ * # Errors
2441
+ *
2442
+ * Malformed hex or mode, oversize or mis-sliced packs, or any
2443
+ * [`verify::VerifyError`].
2444
+ * @param {string} root_hex
2445
+ * @param {string} mode
2446
+ * @param {Uint8Array} packs
2447
+ * @param {string} pack_lengths_json
2448
+ * @returns {string}
2449
+ */
2450
+ export function verify_closure_packs(root_hex, mode, packs, pack_lengths_json) {
2451
+ let deferred6_0;
2452
+ let deferred6_1;
2453
+ try {
2454
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2455
+ const ptr0 = passStringToWasm0(root_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2456
+ const len0 = WASM_VECTOR_LEN;
2457
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2458
+ const len1 = WASM_VECTOR_LEN;
2459
+ const ptr2 = passArray8ToWasm0(packs, wasm.__wbindgen_export2);
2460
+ const len2 = WASM_VECTOR_LEN;
2461
+ const ptr3 = passStringToWasm0(pack_lengths_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2462
+ const len3 = WASM_VECTOR_LEN;
2463
+ wasm.verify_closure_packs(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
2464
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2465
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2466
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2467
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2468
+ var ptr5 = r0;
2469
+ var len5 = r1;
2470
+ if (r3) {
2471
+ ptr5 = 0; len5 = 0;
2472
+ throw takeObject(r2);
2473
+ }
2474
+ deferred6_0 = ptr5;
2475
+ deferred6_1 = len5;
2476
+ return getStringFromWasm0(ptr5, len5);
2477
+ } finally {
2478
+ wasm.__wbindgen_add_to_stack_pointer(16);
2479
+ wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
2480
+ }
2481
+ }
2482
+
2483
+ /**
2484
+ * Verify a disclosure bundle against a trusted commit id.
2485
+ *
2486
+ * Returns JSON `{ commit_id, tree_hash, path, leaf_id, signer,
2487
+ * signature_valid, payload, step_inner_roots, chunk_inner_root }`
2488
+ * **without** payload bytes. Call
2489
+ * [`disclosure_payload_bytes`] for the verified bytes. Both functions
2490
+ * re-verify; a caller that wants both should call this first and treat a
2491
+ * failure of either as a failure.
2492
+ *
2493
+ * `path` entries are `{ name }` (UTF-8 or `null`), `{ name_hex }`, and
2494
+ * `{ mode }` (`blob` / `tree` / `symlink` / `exec`). Payload `kind` is
2495
+ * `object`, `chunk`, or `range`. Bundles larger than 64 MiB
2496
+ * ([`MAX_BUNDLE_BYTES`]) are rejected before decode.
2497
+ *
2498
+ * # Errors
2499
+ *
2500
+ * Malformed hex, an oversize bundle, or any [`verify::VerifyError`].
2501
+ * @param {string} commit_id_hex
2502
+ * @param {Uint8Array} bundle
2503
+ * @returns {string}
2504
+ */
2505
+ export function verify_disclosure(commit_id_hex, bundle) {
2506
+ let deferred4_0;
2507
+ let deferred4_1;
2508
+ try {
2509
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2510
+ const ptr0 = passStringToWasm0(commit_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2511
+ const len0 = WASM_VECTOR_LEN;
2512
+ const ptr1 = passArray8ToWasm0(bundle, wasm.__wbindgen_export2);
2513
+ const len1 = WASM_VECTOR_LEN;
2514
+ wasm.verify_disclosure(retptr, ptr0, len0, ptr1, len1);
2515
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2516
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2517
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2518
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2519
+ var ptr3 = r0;
2520
+ var len3 = r1;
2521
+ if (r3) {
2522
+ ptr3 = 0; len3 = 0;
2523
+ throw takeObject(r2);
2524
+ }
2525
+ deferred4_0 = ptr3;
2526
+ deferred4_1 = len3;
2527
+ return getStringFromWasm0(ptr3, len3);
2528
+ } finally {
2529
+ wasm.__wbindgen_add_to_stack_pointer(16);
2530
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
2531
+ }
2532
+ }
2533
+
2534
+ /**
2535
+ * Verify a KDSP v1 span container against a trusted commit id.
2536
+ *
2537
+ * The JSON contains `commit_id`, `tree_hash`, `path`, `leaf_id`, `signer`,
2538
+ * `signature_valid`, `offset`, `bytes_len`, `bytes_blake3`, `first`, `last`,
2539
+ * `span_start`, and `chunk_inner_root`. A `path` entry has `name` (UTF-8 or
2540
+ * `null`), `name_hex`, and `mode`. The bytes are returned by the getter of
2541
+ * the same [`VerifiedSpan`] and are never reverified. Input is capped at
2542
+ * 64 MiB. Every error starts with a SPEC-DISCLOSURE §8.2 reason label,
2543
+ * except a malformed `commit_id_hex`, which is not a §8.2 condition and
2544
+ * starts with `invalid_input:`.
2545
+ *
2546
+ * # Errors
2547
+ *
2548
+ * Invalid commit hex, an oversized container, malformed framing, or a
2549
+ * failed cryptographic or span check.
2550
+ * @param {string} commit_id_hex
2551
+ * @param {Uint8Array} bundle
2552
+ * @returns {VerifiedSpan}
2553
+ */
2554
+ export function verify_disclosure_span(commit_id_hex, bundle) {
2555
+ try {
2556
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2557
+ const ptr0 = passStringToWasm0(commit_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2558
+ const len0 = WASM_VECTOR_LEN;
2559
+ const ptr1 = passArray8ToWasm0(bundle, wasm.__wbindgen_export2);
2560
+ const len1 = WASM_VECTOR_LEN;
2561
+ wasm.verify_disclosure_span(retptr, ptr0, len0, ptr1, len1);
2562
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2563
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2564
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2565
+ if (r2) {
2566
+ throw takeObject(r1);
2567
+ }
2568
+ return VerifiedSpan.__wrap(r0);
2569
+ } finally {
2570
+ wasm.__wbindgen_add_to_stack_pointer(16);
2571
+ }
2572
+ }
2573
+
2574
+ /**
2575
+ * Verify a single tree-entry inclusion proof against a tree object id.
2576
+ *
2577
+ * `entry_json` is `{ "name" | "name_hex", "mode", "object_hash" }`.
2578
+ * `mode` matches [`crate::tree_encode`]: `blob` / `tree` / `symlink` /
2579
+ * `exec`. `object_hash` is 64-char lowercase hex. Returns `Ok(false)`
2580
+ * when the proof does not fold to `tree_id_hex`
2581
+ * ([`MerkleError::VerificationFailed`]); `Err` on malformed input.
2582
+ *
2583
+ * # Errors
2584
+ *
2585
+ * Malformed hex, JSON, or proof bytes, or any merkle error other than
2586
+ * [`MerkleError::VerificationFailed`].
2587
+ * @param {string} tree_id_hex
2588
+ * @param {string} entry_json
2589
+ * @param {number} position
2590
+ * @param {Uint8Array} proof
2591
+ * @returns {boolean}
2592
+ */
2593
+ export function verify_tree_entry(tree_id_hex, entry_json, position, proof) {
2594
+ try {
2595
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2596
+ const ptr0 = passStringToWasm0(tree_id_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2597
+ const len0 = WASM_VECTOR_LEN;
2598
+ const ptr1 = passStringToWasm0(entry_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2599
+ const len1 = WASM_VECTOR_LEN;
2600
+ const ptr2 = passArray8ToWasm0(proof, wasm.__wbindgen_export2);
2601
+ const len2 = WASM_VECTOR_LEN;
2602
+ wasm.verify_tree_entry(retptr, ptr0, len0, ptr1, len1, position, ptr2, len2);
2603
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2604
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2605
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2606
+ if (r2) {
2607
+ throw takeObject(r1);
2608
+ }
2609
+ return r0 !== 0;
2610
+ } finally {
2611
+ wasm.__wbindgen_add_to_stack_pointer(16);
2612
+ }
2613
+ }
2614
+
2615
+ /**
2616
+ * Verify a browser passkey (`WebAuthn` / P-256) assertion against a DSSE
2617
+ * PAE — cryptographic checks only, no ceremony policy.
2618
+ *
2619
+ * Thin wrapper over `kit_attest::verify_webauthn_wrapping`. Checks the
2620
+ * `type == "webauthn.get"`, `challenge == base64url-nopad(pae)`, the
2621
+ * `authenticatorData` shape, and the P-256 signature over
2622
+ * `authenticatorData || SHA-256(clientDataJSON)`. It does NOT bind the
2623
+ * RP ID or origin — use [`verify_webauthn_wrapping_with_policy`] for
2624
+ * that (which is what a real demo should do, pinning the RP ID to the
2625
+ * site so the green check proves origin binding, not just a signature).
2626
+ *
2627
+ * * `pae` — the bytes from [`attest_pae`].
2628
+ * * `authenticator_data` / `client_data_json` — raw bytes from the
2629
+ * browser assertion (`response.authenticatorData` /
2630
+ * `response.clientDataJSON`), passed as a `Uint8Array`.
2631
+ * * `pubkey_hex` — SEC1 P-256 public key, 33-byte compressed (66 hex)
2632
+ * or 65-byte uncompressed (130 hex).
2633
+ * * `signature` — 64-byte compact `r || s` (DER must be converted and
2634
+ * low-S-normalised JS-side first).
2635
+ *
2636
+ * Returns `Ok(())` when the assertion verifies. On failure the `Err`
2637
+ * carries the typed reason (challenge mismatch, signature failed, …) so
2638
+ * the demo can show *why* — more instructive than a bare boolean.
2639
+ *
2640
+ * # Errors
2641
+ * `pubkey_hex` is not valid hex, or any `WebAuthn` verification failure.
2642
+ * @param {Uint8Array} pae
2643
+ * @param {Uint8Array} authenticator_data
2644
+ * @param {Uint8Array} client_data_json
2645
+ * @param {string} pubkey_hex
2646
+ * @param {Uint8Array} signature
2647
+ */
2648
+ export function verify_webauthn_wrapping(pae, authenticator_data, client_data_json, pubkey_hex, signature) {
2649
+ try {
2650
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2651
+ const ptr0 = passArray8ToWasm0(pae, wasm.__wbindgen_export2);
2652
+ const len0 = WASM_VECTOR_LEN;
2653
+ const ptr1 = passArray8ToWasm0(authenticator_data, wasm.__wbindgen_export2);
2654
+ const len1 = WASM_VECTOR_LEN;
2655
+ const ptr2 = passArray8ToWasm0(client_data_json, wasm.__wbindgen_export2);
2656
+ const len2 = WASM_VECTOR_LEN;
2657
+ const ptr3 = passStringToWasm0(pubkey_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2658
+ const len3 = WASM_VECTOR_LEN;
2659
+ const ptr4 = passArray8ToWasm0(signature, wasm.__wbindgen_export2);
2660
+ const len4 = WASM_VECTOR_LEN;
2661
+ wasm.verify_webauthn_wrapping(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
2662
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2663
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2664
+ if (r1) {
2665
+ throw takeObject(r0);
2666
+ }
2667
+ } finally {
2668
+ wasm.__wbindgen_add_to_stack_pointer(16);
2669
+ }
2670
+ }
2671
+
2672
+ /**
2673
+ * Policy-aware counterpart of [`verify_webauthn_wrapping`].
2674
+ *
2675
+ * Same cryptographic checks, plus the ceremony policy parsed from
2676
+ * `policy_json` — an empty string (or `"{}"`) is fully permissive.
2677
+ * Recognised keys (all optional):
2678
+ *
2679
+ * ```json
2680
+ * {
2681
+ * "expected_rp_id": "kit.storage",
2682
+ * "allowed_origins": ["https://kit.storage"],
2683
+ * "require_user_presence": true,
2684
+ * "require_user_verification": false,
2685
+ * "allow_cross_origin": false,
2686
+ * "previous_sign_count": 0
2687
+ * }
2688
+ * ```
2689
+ *
2690
+ * Defaults match `WebAuthnPolicy::permissive` (no RP-ID/origin binding,
2691
+ * UP/UV off, cross-origin allowed, counter unenforced) — only keys
2692
+ * present in `policy_json` tighten the check.
2693
+ *
2694
+ * # Errors
2695
+ * Malformed `policy_json`, `pubkey_hex` is not valid hex, or any
2696
+ * `WebAuthn` verification failure.
2697
+ * @param {Uint8Array} pae
2698
+ * @param {Uint8Array} authenticator_data
2699
+ * @param {Uint8Array} client_data_json
2700
+ * @param {string} pubkey_hex
2701
+ * @param {Uint8Array} signature
2702
+ * @param {string} policy_json
2703
+ */
2704
+ export function verify_webauthn_wrapping_with_policy(pae, authenticator_data, client_data_json, pubkey_hex, signature, policy_json) {
2705
+ try {
2706
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2707
+ const ptr0 = passArray8ToWasm0(pae, wasm.__wbindgen_export2);
2708
+ const len0 = WASM_VECTOR_LEN;
2709
+ const ptr1 = passArray8ToWasm0(authenticator_data, wasm.__wbindgen_export2);
2710
+ const len1 = WASM_VECTOR_LEN;
2711
+ const ptr2 = passArray8ToWasm0(client_data_json, wasm.__wbindgen_export2);
2712
+ const len2 = WASM_VECTOR_LEN;
2713
+ const ptr3 = passStringToWasm0(pubkey_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2714
+ const len3 = WASM_VECTOR_LEN;
2715
+ const ptr4 = passArray8ToWasm0(signature, wasm.__wbindgen_export2);
2716
+ const len4 = WASM_VECTOR_LEN;
2717
+ const ptr5 = passStringToWasm0(policy_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2718
+ const len5 = WASM_VECTOR_LEN;
2719
+ wasm.verify_webauthn_wrapping_with_policy(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
2720
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2721
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2722
+ if (r1) {
2723
+ throw takeObject(r0);
2724
+ }
2725
+ } finally {
2726
+ wasm.__wbindgen_add_to_stack_pointer(16);
2727
+ }
2728
+ }
2729
+
2730
+ /**
2731
+ * Wrap a BMT inner root with the kit type domain, producing the object id.
2732
+ *
2733
+ * `kind` is `"tree"` or `"chunked_blob"`. For a commonware BMT verifier
2734
+ * that checked the inner root, this is the remaining step before
2735
+ * comparing to an kit id.
2736
+ *
2737
+ * # Errors
2738
+ *
2739
+ * Unknown `kind` or malformed hex.
2740
+ * @param {string} kind
2741
+ * @param {string} inner_root_hex
2742
+ * @returns {string}
2743
+ */
2744
+ export function wrap_object_id(kind, inner_root_hex) {
2745
+ let deferred4_0;
2746
+ let deferred4_1;
2747
+ try {
2748
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2749
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2750
+ const len0 = WASM_VECTOR_LEN;
2751
+ const ptr1 = passStringToWasm0(inner_root_hex, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
2752
+ const len1 = WASM_VECTOR_LEN;
2753
+ wasm.wrap_object_id(retptr, ptr0, len0, ptr1, len1);
2754
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2755
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2756
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2757
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2758
+ var ptr3 = r0;
2759
+ var len3 = r1;
2760
+ if (r3) {
2761
+ ptr3 = 0; len3 = 0;
2762
+ throw takeObject(r2);
2763
+ }
2764
+ deferred4_0 = ptr3;
2765
+ deferred4_1 = len3;
2766
+ return getStringFromWasm0(ptr3, len3);
2767
+ } finally {
2768
+ wasm.__wbindgen_add_to_stack_pointer(16);
2769
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
2770
+ }
2771
+ }
2772
+ export function __wbg_Error_30c8987f7c2ed4e2(arg0, arg1) {
2773
+ const ret = Error(getStringFromWasm0(arg0, arg1));
2774
+ return addHeapObject(ret);
2775
+ }
2776
+ export function __wbg___wbindgen_throw_41e9ee4f547fc59a(arg0, arg1) {
2777
+ throw new Error(getStringFromWasm0(arg0, arg1));
2778
+ }
2779
+ export function __wbg_getRandomValues_436a51d0629d84e1() { return handleError(function (arg0, arg1) {
2780
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2781
+ }, arguments); }
2782
+ export function __wbindgen_generic_0000000000000001(arg0, arg1) {
2783
+ // Cast intrinsic for `Ref(String) -> Externref`.
2784
+ const ret = getStringFromWasm0(arg0, arg1);
2785
+ return addHeapObject(ret);
2786
+ }
2787
+ export function __wbindgen_object_drop_ref(arg0) {
2788
+ takeObject(arg0);
2789
+ }
2790
+ const AttestKeyPairJsFinalization = (typeof FinalizationRegistry === 'undefined')
2791
+ ? { register: () => {}, unregister: () => {} }
2792
+ : new FinalizationRegistry(ptr => wasm.__wbg_attestkeypairjs_free(ptr, 1));
2793
+ const AttestationJsFinalization = (typeof FinalizationRegistry === 'undefined')
2794
+ ? { register: () => {}, unregister: () => {} }
2795
+ : new FinalizationRegistry(ptr => wasm.__wbg_attestationjs_free(ptr, 1));
2796
+ const BaoEncodedFinalization = (typeof FinalizationRegistry === 'undefined')
2797
+ ? { register: () => {}, unregister: () => {} }
2798
+ : new FinalizationRegistry(ptr => wasm.__wbg_baoencoded_free(ptr, 1));
2799
+ const BaoVerifyFinalization = (typeof FinalizationRegistry === 'undefined')
2800
+ ? { register: () => {}, unregister: () => {} }
2801
+ : new FinalizationRegistry(ptr => wasm.__wbg_baoverify_free(ptr, 1));
2802
+ const ChunkInfoFinalization = (typeof FinalizationRegistry === 'undefined')
2803
+ ? { register: () => {}, unregister: () => {} }
2804
+ : new FinalizationRegistry(ptr => wasm.__wbg_chunkinfo_free(ptr, 1));
2805
+ const ChunkedBlobJsFinalization = (typeof FinalizationRegistry === 'undefined')
2806
+ ? { register: () => {}, unregister: () => {} }
2807
+ : new FinalizationRegistry(ptr => wasm.__wbg_chunkedblobjs_free(ptr, 1));
2808
+ const ChunkerResultFinalization = (typeof FinalizationRegistry === 'undefined')
2809
+ ? { register: () => {}, unregister: () => {} }
2810
+ : new FinalizationRegistry(ptr => wasm.__wbg_chunkerresult_free(ptr, 1));
2811
+ const CommitInfoJsFinalization = (typeof FinalizationRegistry === 'undefined')
2812
+ ? { register: () => {}, unregister: () => {} }
2813
+ : new FinalizationRegistry(ptr => wasm.__wbg_commitinfojs_free(ptr, 1));
2814
+ const DeltaOpFinalization = (typeof FinalizationRegistry === 'undefined')
2815
+ ? { register: () => {}, unregister: () => {} }
2816
+ : new FinalizationRegistry(ptr => wasm.__wbg_deltaop_free(ptr, 1));
2817
+ const DeltaSummaryFinalization = (typeof FinalizationRegistry === 'undefined')
2818
+ ? { register: () => {}, unregister: () => {} }
2819
+ : new FinalizationRegistry(ptr => wasm.__wbg_deltasummary_free(ptr, 1));
2820
+ const EncodedCommitFinalization = (typeof FinalizationRegistry === 'undefined')
2821
+ ? { register: () => {}, unregister: () => {} }
2822
+ : new FinalizationRegistry(ptr => wasm.__wbg_encodedcommit_free(ptr, 1));
2823
+ const EncodedObjectFinalization = (typeof FinalizationRegistry === 'undefined')
2824
+ ? { register: () => {}, unregister: () => {} }
2825
+ : new FinalizationRegistry(ptr => wasm.__wbg_encodedobject_free(ptr, 1));
2826
+ const KeyPairJsFinalization = (typeof FinalizationRegistry === 'undefined')
2827
+ ? { register: () => {}, unregister: () => {} }
2828
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypairjs_free(ptr, 1));
2829
+ const RemixInfoJsFinalization = (typeof FinalizationRegistry === 'undefined')
2830
+ ? { register: () => {}, unregister: () => {} }
2831
+ : new FinalizationRegistry(ptr => wasm.__wbg_remixinfojs_free(ptr, 1));
2832
+ const RemixSourceJsFinalization = (typeof FinalizationRegistry === 'undefined')
2833
+ ? { register: () => {}, unregister: () => {} }
2834
+ : new FinalizationRegistry(ptr => wasm.__wbg_remixsourcejs_free(ptr, 1));
2835
+ const VerifiedSpanFinalization = (typeof FinalizationRegistry === 'undefined')
2836
+ ? { register: () => {}, unregister: () => {} }
2837
+ : new FinalizationRegistry(ptr => wasm.__wbg_verifiedspan_free(ptr, 1));
2838
+
2839
+ function addHeapObject(obj) {
2840
+ if (heap_next === heap.length) heap.push(heap.length + 1);
2841
+ const idx = heap_next;
2842
+ heap_next = heap[idx];
2843
+
2844
+ heap[idx] = obj;
2845
+ return idx;
2846
+ }
2847
+
2848
+ function dropObject(idx) {
2849
+ if (idx < 1028) return;
2850
+ heap[idx] = heap_next;
2851
+ heap_next = idx;
2852
+ }
2853
+
2854
+ function getArrayU8FromWasm0(ptr, len) {
2855
+ ptr = ptr >>> 0;
2856
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2857
+ }
2858
+
2859
+ let cachedDataViewMemory0 = null;
2860
+ function getDataViewMemory0() {
2861
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2862
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2863
+ }
2864
+ return cachedDataViewMemory0;
2865
+ }
2866
+
2867
+ function getStringFromWasm0(ptr, len) {
2868
+ return decodeText(ptr >>> 0, len);
2869
+ }
2870
+
2871
+ let cachedUint8ArrayMemory0 = null;
2872
+ function getUint8ArrayMemory0() {
2873
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2874
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2875
+ }
2876
+ return cachedUint8ArrayMemory0;
2877
+ }
2878
+
2879
+ function getObject(idx) { return heap[idx]; }
2880
+
2881
+ function handleError(f, args) {
2882
+ try {
2883
+ return f.apply(this, args);
2884
+ } catch (e) {
2885
+ wasm.__wbindgen_export(addHeapObject(e));
2886
+ }
2887
+ }
2888
+
2889
+ let heap = new Array(1024).fill(undefined);
2890
+ heap.push(undefined, null, true, false);
2891
+
2892
+ let heap_next = heap.length;
2893
+
2894
+ function passArray8ToWasm0(arg, malloc) {
2895
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
2896
+ getUint8ArrayMemory0().set(arg, ptr / 1);
2897
+ WASM_VECTOR_LEN = arg.length;
2898
+ return ptr;
2899
+ }
2900
+
2901
+ function passStringToWasm0(arg, malloc, realloc) {
2902
+ if (realloc === undefined) {
2903
+ const buf = cachedTextEncoder.encode(arg);
2904
+ const ptr = malloc(buf.length, 1) >>> 0;
2905
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2906
+ WASM_VECTOR_LEN = buf.length;
2907
+ return ptr;
2908
+ }
2909
+
2910
+ let len = arg.length;
2911
+ let ptr = malloc(len, 1) >>> 0;
2912
+
2913
+ const mem = getUint8ArrayMemory0();
2914
+
2915
+ let offset = 0;
2916
+
2917
+ for (; offset < len; offset++) {
2918
+ const code = arg.charCodeAt(offset);
2919
+ if (code > 0x7F) break;
2920
+ mem[ptr + offset] = code;
2921
+ }
2922
+ if (offset !== len) {
2923
+ if (offset !== 0) {
2924
+ arg = arg.slice(offset);
2925
+ }
2926
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2927
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2928
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2929
+
2930
+ offset += ret.written;
2931
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
2932
+ }
2933
+
2934
+ WASM_VECTOR_LEN = offset;
2935
+ return ptr;
2936
+ }
2937
+
2938
+ function takeObject(idx) {
2939
+ const ret = getObject(idx);
2940
+ dropObject(idx);
2941
+ return ret;
2942
+ }
2943
+
2944
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2945
+ cachedTextDecoder.decode();
2946
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2947
+ let numBytesDecoded = 0;
2948
+ function decodeText(ptr, len) {
2949
+ numBytesDecoded += len;
2950
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2951
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2952
+ cachedTextDecoder.decode();
2953
+ numBytesDecoded = len;
2954
+ }
2955
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2956
+ }
2957
+
2958
+ const cachedTextEncoder = new TextEncoder();
2959
+
2960
+ if (!('encodeInto' in cachedTextEncoder)) {
2961
+ cachedTextEncoder.encodeInto = function (arg, view) {
2962
+ const buf = cachedTextEncoder.encode(arg);
2963
+ view.set(buf);
2964
+ return {
2965
+ read: arg.length,
2966
+ written: buf.length
2967
+ };
2968
+ };
2969
+ }
2970
+
2971
+ let WASM_VECTOR_LEN = 0;
2972
+
2973
+
2974
+ let wasm;
2975
+ export function __wbg_set_wasm(val) {
2976
+ wasm = val;
2977
+ }