superid_agent_core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1383 @@
1
+
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+
5
+ function addToExternrefTable0(obj) {
6
+ const idx = wasm.__externref_table_alloc();
7
+ wasm.__wbindgen_export_2.set(idx, obj);
8
+ return idx;
9
+ }
10
+
11
+ function handleError(f, args) {
12
+ try {
13
+ return f.apply(this, args);
14
+ } catch (e) {
15
+ const idx = addToExternrefTable0(e);
16
+ wasm.__wbindgen_exn_store(idx);
17
+ }
18
+ }
19
+
20
+ let cachedUint8ArrayMemory0 = null;
21
+
22
+ function getUint8ArrayMemory0() {
23
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
24
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
25
+ }
26
+ return cachedUint8ArrayMemory0;
27
+ }
28
+
29
+ function getArrayU8FromWasm0(ptr, len) {
30
+ ptr = ptr >>> 0;
31
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
32
+ }
33
+
34
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
35
+
36
+ cachedTextDecoder.decode();
37
+
38
+ function decodeText(ptr, len) {
39
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
40
+ }
41
+
42
+ function getStringFromWasm0(ptr, len) {
43
+ ptr = ptr >>> 0;
44
+ return decodeText(ptr, len);
45
+ }
46
+
47
+ function isLikeNone(x) {
48
+ return x === undefined || x === null;
49
+ }
50
+
51
+ let WASM_VECTOR_LEN = 0;
52
+
53
+ const cachedTextEncoder = new TextEncoder();
54
+
55
+ if (!('encodeInto' in cachedTextEncoder)) {
56
+ cachedTextEncoder.encodeInto = function (arg, view) {
57
+ const buf = cachedTextEncoder.encode(arg);
58
+ view.set(buf);
59
+ return {
60
+ read: arg.length,
61
+ written: buf.length
62
+ };
63
+ }
64
+ }
65
+
66
+ function passStringToWasm0(arg, malloc, realloc) {
67
+
68
+ if (realloc === undefined) {
69
+ const buf = cachedTextEncoder.encode(arg);
70
+ const ptr = malloc(buf.length, 1) >>> 0;
71
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
72
+ WASM_VECTOR_LEN = buf.length;
73
+ return ptr;
74
+ }
75
+
76
+ let len = arg.length;
77
+ let ptr = malloc(len, 1) >>> 0;
78
+
79
+ const mem = getUint8ArrayMemory0();
80
+
81
+ let offset = 0;
82
+
83
+ for (; offset < len; offset++) {
84
+ const code = arg.charCodeAt(offset);
85
+ if (code > 0x7F) break;
86
+ mem[ptr + offset] = code;
87
+ }
88
+
89
+ if (offset !== len) {
90
+ if (offset !== 0) {
91
+ arg = arg.slice(offset);
92
+ }
93
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
94
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
95
+ const ret = cachedTextEncoder.encodeInto(arg, view);
96
+
97
+ offset += ret.written;
98
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
99
+ }
100
+
101
+ WASM_VECTOR_LEN = offset;
102
+ return ptr;
103
+ }
104
+ /**
105
+ * WASM wrapper: accepts opts JSON, returns `DidCreateResult` JSON
106
+ * @param {string} opts_json
107
+ * @returns {string}
108
+ */
109
+ exports.create_did_superid_wasm = function(opts_json) {
110
+ let deferred2_0;
111
+ let deferred2_1;
112
+ try {
113
+ const ptr0 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
114
+ const len0 = WASM_VECTOR_LEN;
115
+ const ret = wasm.create_did_superid_wasm(ptr0, len0);
116
+ deferred2_0 = ret[0];
117
+ deferred2_1 = ret[1];
118
+ return getStringFromWasm0(ret[0], ret[1]);
119
+ } finally {
120
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
121
+ }
122
+ };
123
+
124
+ /**
125
+ * ---------- Utilities ----------
126
+ * @param {string} data_b64u
127
+ * @returns {string}
128
+ */
129
+ exports.hash_sha256_json = function(data_b64u) {
130
+ let deferred2_0;
131
+ let deferred2_1;
132
+ try {
133
+ const ptr0 = passStringToWasm0(data_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ const ret = wasm.hash_sha256_json(ptr0, len0);
136
+ deferred2_0 = ret[0];
137
+ deferred2_1 = ret[1];
138
+ return getStringFromWasm0(ret[0], ret[1]);
139
+ } finally {
140
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
141
+ }
142
+ };
143
+
144
+ /**
145
+ * @param {number} len_u32
146
+ * @returns {string}
147
+ */
148
+ exports.rng_bytes_json = function(len_u32) {
149
+ let deferred1_0;
150
+ let deferred1_1;
151
+ try {
152
+ const ret = wasm.rng_bytes_json(len_u32);
153
+ deferred1_0 = ret[0];
154
+ deferred1_1 = ret[1];
155
+ return getStringFromWasm0(ret[0], ret[1]);
156
+ } finally {
157
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
158
+ }
159
+ };
160
+
161
+ /**
162
+ * @param {string} json
163
+ * @returns {string}
164
+ */
165
+ exports.json_canonicalize_json = function(json) {
166
+ let deferred2_0;
167
+ let deferred2_1;
168
+ try {
169
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ const ret = wasm.json_canonicalize_json(ptr0, len0);
172
+ deferred2_0 = ret[0];
173
+ deferred2_1 = ret[1];
174
+ return getStringFromWasm0(ret[0], ret[1]);
175
+ } finally {
176
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
177
+ }
178
+ };
179
+
180
+ /**
181
+ * ---------- DID create ----------
182
+ * @param {string} opts_json
183
+ * @returns {string}
184
+ */
185
+ exports.did_create_superid_json = function(opts_json) {
186
+ let deferred2_0;
187
+ let deferred2_1;
188
+ try {
189
+ const ptr0 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
190
+ const len0 = WASM_VECTOR_LEN;
191
+ const ret = wasm.did_create_superid_json(ptr0, len0);
192
+ deferred2_0 = ret[0];
193
+ deferred2_1 = ret[1];
194
+ return getStringFromWasm0(ret[0], ret[1]);
195
+ } finally {
196
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
197
+ }
198
+ };
199
+
200
+ /**
201
+ * ---------- X25519 ----------
202
+ * @returns {string}
203
+ */
204
+ exports.agent_gen_x25519_json = function() {
205
+ let deferred1_0;
206
+ let deferred1_1;
207
+ try {
208
+ const ret = wasm.agent_gen_x25519_json();
209
+ deferred1_0 = ret[0];
210
+ deferred1_1 = ret[1];
211
+ return getStringFromWasm0(ret[0], ret[1]);
212
+ } finally {
213
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
214
+ }
215
+ };
216
+
217
+ /**
218
+ * @param {string} secret
219
+ * @returns {string}
220
+ */
221
+ exports.agent_import_x25519_json = function(secret) {
222
+ let deferred2_0;
223
+ let deferred2_1;
224
+ try {
225
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ const ret = wasm.agent_import_x25519_json(ptr0, len0);
228
+ deferred2_0 = ret[0];
229
+ deferred2_1 = ret[1];
230
+ return getStringFromWasm0(ret[0], ret[1]);
231
+ } finally {
232
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
233
+ }
234
+ };
235
+
236
+ /**
237
+ * @param {string} handle
238
+ * @returns {string}
239
+ */
240
+ exports.agent_export_x25519_json = function(handle) {
241
+ let deferred2_0;
242
+ let deferred2_1;
243
+ try {
244
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ const ret = wasm.agent_export_x25519_json(ptr0, len0);
247
+ deferred2_0 = ret[0];
248
+ deferred2_1 = ret[1];
249
+ return getStringFromWasm0(ret[0], ret[1]);
250
+ } finally {
251
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
252
+ }
253
+ };
254
+
255
+ /**
256
+ * ---------- Ed25519 ----------
257
+ * @returns {string}
258
+ */
259
+ exports.ed25519_keygen_json = function() {
260
+ let deferred1_0;
261
+ let deferred1_1;
262
+ try {
263
+ const ret = wasm.ed25519_keygen_json();
264
+ deferred1_0 = ret[0];
265
+ deferred1_1 = ret[1];
266
+ return getStringFromWasm0(ret[0], ret[1]);
267
+ } finally {
268
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
269
+ }
270
+ };
271
+
272
+ /**
273
+ * @param {string} secret
274
+ * @returns {string}
275
+ */
276
+ exports.ed25519_import_json = function(secret) {
277
+ let deferred2_0;
278
+ let deferred2_1;
279
+ try {
280
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
281
+ const len0 = WASM_VECTOR_LEN;
282
+ const ret = wasm.ed25519_import_json(ptr0, len0);
283
+ deferred2_0 = ret[0];
284
+ deferred2_1 = ret[1];
285
+ return getStringFromWasm0(ret[0], ret[1]);
286
+ } finally {
287
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
288
+ }
289
+ };
290
+
291
+ /**
292
+ * @param {string} handle
293
+ * @returns {string}
294
+ */
295
+ exports.ed25519_export_json = function(handle) {
296
+ let deferred2_0;
297
+ let deferred2_1;
298
+ try {
299
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
300
+ const len0 = WASM_VECTOR_LEN;
301
+ const ret = wasm.ed25519_export_json(ptr0, len0);
302
+ deferred2_0 = ret[0];
303
+ deferred2_1 = ret[1];
304
+ return getStringFromWasm0(ret[0], ret[1]);
305
+ } finally {
306
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
307
+ }
308
+ };
309
+
310
+ /**
311
+ * @param {string} key_or_handle
312
+ * @param {string} msg_b64u
313
+ * @returns {string}
314
+ */
315
+ exports.ed25519_sign_json = function(key_or_handle, msg_b64u) {
316
+ let deferred3_0;
317
+ let deferred3_1;
318
+ try {
319
+ const ptr0 = passStringToWasm0(key_or_handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const len0 = WASM_VECTOR_LEN;
321
+ const ptr1 = passStringToWasm0(msg_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
+ const len1 = WASM_VECTOR_LEN;
323
+ const ret = wasm.ed25519_sign_json(ptr0, len0, ptr1, len1);
324
+ deferred3_0 = ret[0];
325
+ deferred3_1 = ret[1];
326
+ return getStringFromWasm0(ret[0], ret[1]);
327
+ } finally {
328
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
329
+ }
330
+ };
331
+
332
+ /**
333
+ * @param {string} pub_b64u
334
+ * @param {string} msg_b64u
335
+ * @param {string} sig_b64u
336
+ * @returns {string}
337
+ */
338
+ exports.ed25519_verify_json = function(pub_b64u, msg_b64u, sig_b64u) {
339
+ let deferred4_0;
340
+ let deferred4_1;
341
+ try {
342
+ const ptr0 = passStringToWasm0(pub_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
+ const len0 = WASM_VECTOR_LEN;
344
+ const ptr1 = passStringToWasm0(msg_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
345
+ const len1 = WASM_VECTOR_LEN;
346
+ const ptr2 = passStringToWasm0(sig_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
+ const len2 = WASM_VECTOR_LEN;
348
+ const ret = wasm.ed25519_verify_json(ptr0, len0, ptr1, len1, ptr2, len2);
349
+ deferred4_0 = ret[0];
350
+ deferred4_1 = ret[1];
351
+ return getStringFromWasm0(ret[0], ret[1]);
352
+ } finally {
353
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
354
+ }
355
+ };
356
+
357
+ /**
358
+ * ---------- DID & DIDDoc ----------
359
+ * @param {string} ed_b64u_or_mb
360
+ * @returns {string}
361
+ */
362
+ exports.did_superid_from_ed25519_pub_json = function(ed_b64u_or_mb) {
363
+ let deferred2_0;
364
+ let deferred2_1;
365
+ try {
366
+ const ptr0 = passStringToWasm0(ed_b64u_or_mb, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
367
+ const len0 = WASM_VECTOR_LEN;
368
+ const ret = wasm.did_superid_from_ed25519_pub_json(ptr0, len0);
369
+ deferred2_0 = ret[0];
370
+ deferred2_1 = ret[1];
371
+ return getStringFromWasm0(ret[0], ret[1]);
372
+ } finally {
373
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
374
+ }
375
+ };
376
+
377
+ /**
378
+ * @param {string} params_json
379
+ * @returns {string}
380
+ */
381
+ exports.did_superid_build_doc_json = function(params_json) {
382
+ let deferred2_0;
383
+ let deferred2_1;
384
+ try {
385
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ const ret = wasm.did_superid_build_doc_json(ptr0, len0);
388
+ deferred2_0 = ret[0];
389
+ deferred2_1 = ret[1];
390
+ return getStringFromWasm0(ret[0], ret[1]);
391
+ } finally {
392
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
393
+ }
394
+ };
395
+
396
+ /**
397
+ * @param {string} ed25519_handle
398
+ * @param {string} diddoc_json
399
+ * @returns {string}
400
+ */
401
+ exports.diddoc_sign_json = function(ed25519_handle, diddoc_json) {
402
+ let deferred3_0;
403
+ let deferred3_1;
404
+ try {
405
+ const ptr0 = passStringToWasm0(ed25519_handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
406
+ const len0 = WASM_VECTOR_LEN;
407
+ const ptr1 = passStringToWasm0(diddoc_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
408
+ const len1 = WASM_VECTOR_LEN;
409
+ const ret = wasm.diddoc_sign_json(ptr0, len0, ptr1, len1);
410
+ deferred3_0 = ret[0];
411
+ deferred3_1 = ret[1];
412
+ return getStringFromWasm0(ret[0], ret[1]);
413
+ } finally {
414
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
415
+ }
416
+ };
417
+
418
+ /**
419
+ * @param {string} diddoc_with_proof_json
420
+ * @returns {string}
421
+ */
422
+ exports.diddoc_verify_json = function(diddoc_with_proof_json) {
423
+ let deferred2_0;
424
+ let deferred2_1;
425
+ try {
426
+ const ptr0 = passStringToWasm0(diddoc_with_proof_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ const ret = wasm.diddoc_verify_json(ptr0, len0);
429
+ deferred2_0 = ret[0];
430
+ deferred2_1 = ret[1];
431
+ return getStringFromWasm0(ret[0], ret[1]);
432
+ } finally {
433
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
434
+ }
435
+ };
436
+
437
+ /**
438
+ * ---------- Anoncrypt / Authcrypt ----------
439
+ * @param {string} recipient_pub_b64u
440
+ * @param {string} plaintext_utf8
441
+ * @returns {string}
442
+ */
443
+ exports.anoncrypt_pack_json = function(recipient_pub_b64u, plaintext_utf8) {
444
+ let deferred3_0;
445
+ let deferred3_1;
446
+ try {
447
+ const ptr0 = passStringToWasm0(recipient_pub_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ const len0 = WASM_VECTOR_LEN;
449
+ const ptr1 = passStringToWasm0(plaintext_utf8, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
450
+ const len1 = WASM_VECTOR_LEN;
451
+ const ret = wasm.anoncrypt_pack_json(ptr0, len0, ptr1, len1);
452
+ deferred3_0 = ret[0];
453
+ deferred3_1 = ret[1];
454
+ return getStringFromWasm0(ret[0], ret[1]);
455
+ } finally {
456
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
457
+ }
458
+ };
459
+
460
+ /**
461
+ * @param {string} handle
462
+ * @param {string} jwm_json
463
+ * @returns {string}
464
+ */
465
+ exports.anoncrypt_unpack_json = function(handle, jwm_json) {
466
+ let deferred3_0;
467
+ let deferred3_1;
468
+ try {
469
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ const ptr1 = passStringToWasm0(jwm_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len1 = WASM_VECTOR_LEN;
473
+ const ret = wasm.anoncrypt_unpack_json(ptr0, len0, ptr1, len1);
474
+ deferred3_0 = ret[0];
475
+ deferred3_1 = ret[1];
476
+ return getStringFromWasm0(ret[0], ret[1]);
477
+ } finally {
478
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
479
+ }
480
+ };
481
+
482
+ /**
483
+ * @param {string} sender_handle
484
+ * @param {string} recip_pub_b64u
485
+ * @param {string} plaintext_utf8
486
+ * @param {string | null} [headers_json]
487
+ * @returns {string}
488
+ */
489
+ exports.authcrypt_pack_json = function(sender_handle, recip_pub_b64u, plaintext_utf8, headers_json) {
490
+ let deferred5_0;
491
+ let deferred5_1;
492
+ try {
493
+ const ptr0 = passStringToWasm0(sender_handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
494
+ const len0 = WASM_VECTOR_LEN;
495
+ const ptr1 = passStringToWasm0(recip_pub_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
496
+ const len1 = WASM_VECTOR_LEN;
497
+ const ptr2 = passStringToWasm0(plaintext_utf8, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
498
+ const len2 = WASM_VECTOR_LEN;
499
+ var ptr3 = isLikeNone(headers_json) ? 0 : passStringToWasm0(headers_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
500
+ var len3 = WASM_VECTOR_LEN;
501
+ const ret = wasm.authcrypt_pack_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
502
+ deferred5_0 = ret[0];
503
+ deferred5_1 = ret[1];
504
+ return getStringFromWasm0(ret[0], ret[1]);
505
+ } finally {
506
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
507
+ }
508
+ };
509
+
510
+ /**
511
+ * @param {string} handle
512
+ * @param {string} jwm_json
513
+ * @returns {string}
514
+ */
515
+ exports.authcrypt_unpack_json = function(handle, jwm_json) {
516
+ let deferred3_0;
517
+ let deferred3_1;
518
+ try {
519
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ptr1 = passStringToWasm0(jwm_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
+ const len1 = WASM_VECTOR_LEN;
523
+ const ret = wasm.authcrypt_unpack_json(ptr0, len0, ptr1, len1);
524
+ deferred3_0 = ret[0];
525
+ deferred3_1 = ret[1];
526
+ return getStringFromWasm0(ret[0], ret[1]);
527
+ } finally {
528
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
529
+ }
530
+ };
531
+
532
+ /**
533
+ * ---------- AEAD / DEK ----------
534
+ * @returns {string}
535
+ */
536
+ exports.dek_generate_json = function() {
537
+ let deferred1_0;
538
+ let deferred1_1;
539
+ try {
540
+ const ret = wasm.dek_generate_json();
541
+ deferred1_0 = ret[0];
542
+ deferred1_1 = ret[1];
543
+ return getStringFromWasm0(ret[0], ret[1]);
544
+ } finally {
545
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
546
+ }
547
+ };
548
+
549
+ /**
550
+ * @param {string} key_b64u
551
+ * @param {string} plaintext_b64u
552
+ * @param {string | null} [aad_b64u]
553
+ * @param {string | null} [nonce_b64u]
554
+ * @returns {string}
555
+ */
556
+ exports.aead_encrypt_xc20p_json = function(key_b64u, plaintext_b64u, aad_b64u, nonce_b64u) {
557
+ let deferred5_0;
558
+ let deferred5_1;
559
+ try {
560
+ const ptr0 = passStringToWasm0(key_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ const ptr1 = passStringToWasm0(plaintext_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
563
+ const len1 = WASM_VECTOR_LEN;
564
+ var ptr2 = isLikeNone(aad_b64u) ? 0 : passStringToWasm0(aad_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
565
+ var len2 = WASM_VECTOR_LEN;
566
+ var ptr3 = isLikeNone(nonce_b64u) ? 0 : passStringToWasm0(nonce_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
567
+ var len3 = WASM_VECTOR_LEN;
568
+ const ret = wasm.aead_encrypt_xc20p_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
569
+ deferred5_0 = ret[0];
570
+ deferred5_1 = ret[1];
571
+ return getStringFromWasm0(ret[0], ret[1]);
572
+ } finally {
573
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
574
+ }
575
+ };
576
+
577
+ /**
578
+ * @param {string} key_b64u
579
+ * @param {string} nonce_b64u
580
+ * @param {string} ciphertext_b64u
581
+ * @param {string | null} [aad_b64u]
582
+ * @returns {string}
583
+ */
584
+ exports.aead_decrypt_xc20p_json = function(key_b64u, nonce_b64u, ciphertext_b64u, aad_b64u) {
585
+ let deferred5_0;
586
+ let deferred5_1;
587
+ try {
588
+ const ptr0 = passStringToWasm0(key_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
589
+ const len0 = WASM_VECTOR_LEN;
590
+ const ptr1 = passStringToWasm0(nonce_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
591
+ const len1 = WASM_VECTOR_LEN;
592
+ const ptr2 = passStringToWasm0(ciphertext_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
593
+ const len2 = WASM_VECTOR_LEN;
594
+ var ptr3 = isLikeNone(aad_b64u) ? 0 : passStringToWasm0(aad_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
595
+ var len3 = WASM_VECTOR_LEN;
596
+ const ret = wasm.aead_decrypt_xc20p_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
597
+ deferred5_0 = ret[0];
598
+ deferred5_1 = ret[1];
599
+ return getStringFromWasm0(ret[0], ret[1]);
600
+ } finally {
601
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
602
+ }
603
+ };
604
+
605
+ /**
606
+ * @param {string} recip_pub_b64u
607
+ * @param {string} dek_b64u
608
+ * @returns {string}
609
+ */
610
+ exports.dek_wrap_x25519_json = function(recip_pub_b64u, dek_b64u) {
611
+ let deferred3_0;
612
+ let deferred3_1;
613
+ try {
614
+ const ptr0 = passStringToWasm0(recip_pub_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
615
+ const len0 = WASM_VECTOR_LEN;
616
+ const ptr1 = passStringToWasm0(dek_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
617
+ const len1 = WASM_VECTOR_LEN;
618
+ const ret = wasm.dek_wrap_x25519_json(ptr0, len0, ptr1, len1);
619
+ deferred3_0 = ret[0];
620
+ deferred3_1 = ret[1];
621
+ return getStringFromWasm0(ret[0], ret[1]);
622
+ } finally {
623
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
624
+ }
625
+ };
626
+
627
+ /**
628
+ * @param {string} handle
629
+ * @param {string} edek_b64u
630
+ * @returns {string}
631
+ */
632
+ exports.dek_unwrap_x25519_json = function(handle, edek_b64u) {
633
+ let deferred3_0;
634
+ let deferred3_1;
635
+ try {
636
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
637
+ const len0 = WASM_VECTOR_LEN;
638
+ const ptr1 = passStringToWasm0(edek_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
639
+ const len1 = WASM_VECTOR_LEN;
640
+ const ret = wasm.dek_unwrap_x25519_json(ptr0, len0, ptr1, len1);
641
+ deferred3_0 = ret[0];
642
+ deferred3_1 = ret[1];
643
+ return getStringFromWasm0(ret[0], ret[1]);
644
+ } finally {
645
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
646
+ }
647
+ };
648
+
649
+ /**
650
+ * ---------- VC / Status List ----------
651
+ * @param {string} params_json
652
+ * @returns {string}
653
+ */
654
+ exports.vc_build_json = function(params_json) {
655
+ let deferred2_0;
656
+ let deferred2_1;
657
+ try {
658
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
659
+ const len0 = WASM_VECTOR_LEN;
660
+ const ret = wasm.vc_build_json(ptr0, len0);
661
+ deferred2_0 = ret[0];
662
+ deferred2_1 = ret[1];
663
+ return getStringFromWasm0(ret[0], ret[1]);
664
+ } finally {
665
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
666
+ }
667
+ };
668
+
669
+ /**
670
+ * @param {string} handle
671
+ * @param {string} vc_json
672
+ * @param {string} opts_json
673
+ * @returns {string}
674
+ */
675
+ exports.vc_sign_jwt_json = function(handle, vc_json, opts_json) {
676
+ let deferred4_0;
677
+ let deferred4_1;
678
+ try {
679
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
680
+ const len0 = WASM_VECTOR_LEN;
681
+ const ptr1 = passStringToWasm0(vc_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
682
+ const len1 = WASM_VECTOR_LEN;
683
+ const ptr2 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
684
+ const len2 = WASM_VECTOR_LEN;
685
+ const ret = wasm.vc_sign_jwt_json(ptr0, len0, ptr1, len1, ptr2, len2);
686
+ deferred4_0 = ret[0];
687
+ deferred4_1 = ret[1];
688
+ return getStringFromWasm0(ret[0], ret[1]);
689
+ } finally {
690
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
691
+ }
692
+ };
693
+
694
+ /**
695
+ * @param {string} jwt_str
696
+ * @param {string} opts_json
697
+ * @returns {string}
698
+ */
699
+ exports.vc_verify_jwt_json = function(jwt_str, opts_json) {
700
+ let deferred3_0;
701
+ let deferred3_1;
702
+ try {
703
+ const ptr0 = passStringToWasm0(jwt_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
704
+ const len0 = WASM_VECTOR_LEN;
705
+ const ptr1 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
706
+ const len1 = WASM_VECTOR_LEN;
707
+ const ret = wasm.vc_verify_jwt_json(ptr0, len0, ptr1, len1);
708
+ deferred3_0 = ret[0];
709
+ deferred3_1 = ret[1];
710
+ return getStringFromWasm0(ret[0], ret[1]);
711
+ } finally {
712
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
713
+ }
714
+ };
715
+
716
+ /**
717
+ * @param {string} params_json
718
+ * @returns {string}
719
+ */
720
+ exports.status_list_create_json = function(params_json) {
721
+ let deferred2_0;
722
+ let deferred2_1;
723
+ try {
724
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
725
+ const len0 = WASM_VECTOR_LEN;
726
+ const ret = wasm.status_list_create_json(ptr0, len0);
727
+ deferred2_0 = ret[0];
728
+ deferred2_1 = ret[1];
729
+ return getStringFromWasm0(ret[0], ret[1]);
730
+ } finally {
731
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
732
+ }
733
+ };
734
+
735
+ /**
736
+ * @param {string} list_json
737
+ * @param {number} index
738
+ * @param {boolean} value
739
+ * @returns {string}
740
+ */
741
+ exports.status_list_set_json = function(list_json, index, value) {
742
+ let deferred2_0;
743
+ let deferred2_1;
744
+ try {
745
+ const ptr0 = passStringToWasm0(list_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
746
+ const len0 = WASM_VECTOR_LEN;
747
+ const ret = wasm.status_list_set_json(ptr0, len0, index, value);
748
+ deferred2_0 = ret[0];
749
+ deferred2_1 = ret[1];
750
+ return getStringFromWasm0(ret[0], ret[1]);
751
+ } finally {
752
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
753
+ }
754
+ };
755
+
756
+ /**
757
+ * @param {string} list_json
758
+ * @returns {string}
759
+ */
760
+ exports.status_list_encode_json = function(list_json) {
761
+ let deferred2_0;
762
+ let deferred2_1;
763
+ try {
764
+ const ptr0 = passStringToWasm0(list_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
765
+ const len0 = WASM_VECTOR_LEN;
766
+ const ret = wasm.status_list_encode_json(ptr0, len0);
767
+ deferred2_0 = ret[0];
768
+ deferred2_1 = ret[1];
769
+ return getStringFromWasm0(ret[0], ret[1]);
770
+ } finally {
771
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
772
+ }
773
+ };
774
+
775
+ /**
776
+ * @param {string} handle
777
+ * @param {string} list_json
778
+ * @param {string} opts_json
779
+ * @returns {string}
780
+ */
781
+ exports.status_list_vc_sign_jwt_json = function(handle, list_json, opts_json) {
782
+ let deferred4_0;
783
+ let deferred4_1;
784
+ try {
785
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
786
+ const len0 = WASM_VECTOR_LEN;
787
+ const ptr1 = passStringToWasm0(list_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
788
+ const len1 = WASM_VECTOR_LEN;
789
+ const ptr2 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
790
+ const len2 = WASM_VECTOR_LEN;
791
+ const ret = wasm.status_list_vc_sign_jwt_json(ptr0, len0, ptr1, len1, ptr2, len2);
792
+ deferred4_0 = ret[0];
793
+ deferred4_1 = ret[1];
794
+ return getStringFromWasm0(ret[0], ret[1]);
795
+ } finally {
796
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
797
+ }
798
+ };
799
+
800
+ /**
801
+ * @param {string} jwt_str
802
+ * @param {string} opts_json
803
+ * @returns {string}
804
+ */
805
+ exports.status_list_vc_verify_jwt_json = function(jwt_str, opts_json) {
806
+ let deferred3_0;
807
+ let deferred3_1;
808
+ try {
809
+ const ptr0 = passStringToWasm0(jwt_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
810
+ const len0 = WASM_VECTOR_LEN;
811
+ const ptr1 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
812
+ const len1 = WASM_VECTOR_LEN;
813
+ const ret = wasm.status_list_vc_verify_jwt_json(ptr0, len0, ptr1, len1);
814
+ deferred3_0 = ret[0];
815
+ deferred3_1 = ret[1];
816
+ return getStringFromWasm0(ret[0], ret[1]);
817
+ } finally {
818
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
819
+ }
820
+ };
821
+
822
+ /**
823
+ * ---------- DIDComm message helpers ----------
824
+ * @param {string} typ
825
+ * @param {string} body_json
826
+ * @param {string | null} [thid]
827
+ * @param {string | null} [attachments_json]
828
+ * @returns {string}
829
+ */
830
+ exports.didcomm_build_message_json = function(typ, body_json, thid, attachments_json) {
831
+ let deferred5_0;
832
+ let deferred5_1;
833
+ try {
834
+ const ptr0 = passStringToWasm0(typ, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
835
+ const len0 = WASM_VECTOR_LEN;
836
+ const ptr1 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
837
+ const len1 = WASM_VECTOR_LEN;
838
+ var ptr2 = isLikeNone(thid) ? 0 : passStringToWasm0(thid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
839
+ var len2 = WASM_VECTOR_LEN;
840
+ var ptr3 = isLikeNone(attachments_json) ? 0 : passStringToWasm0(attachments_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
841
+ var len3 = WASM_VECTOR_LEN;
842
+ const ret = wasm.didcomm_build_message_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
843
+ deferred5_0 = ret[0];
844
+ deferred5_1 = ret[1];
845
+ return getStringFromWasm0(ret[0], ret[1]);
846
+ } finally {
847
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
848
+ }
849
+ };
850
+
851
+ /**
852
+ * @param {string} msg_json
853
+ * @returns {string}
854
+ */
855
+ exports.didcomm_validate_message_json = function(msg_json) {
856
+ let deferred2_0;
857
+ let deferred2_1;
858
+ try {
859
+ const ptr0 = passStringToWasm0(msg_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
860
+ const len0 = WASM_VECTOR_LEN;
861
+ const ret = wasm.didcomm_validate_message_json(ptr0, len0);
862
+ deferred2_0 = ret[0];
863
+ deferred2_1 = ret[1];
864
+ return getStringFromWasm0(ret[0], ret[1]);
865
+ } finally {
866
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
867
+ }
868
+ };
869
+
870
+ /**
871
+ * ---------- PoA ----------
872
+ * @param {string} tx_json
873
+ * @returns {string}
874
+ */
875
+ exports.tx_hash_json = function(tx_json) {
876
+ let deferred2_0;
877
+ let deferred2_1;
878
+ try {
879
+ const ptr0 = passStringToWasm0(tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
880
+ const len0 = WASM_VECTOR_LEN;
881
+ const ret = wasm.tx_hash_json(ptr0, len0);
882
+ deferred2_0 = ret[0];
883
+ deferred2_1 = ret[1];
884
+ return getStringFromWasm0(ret[0], ret[1]);
885
+ } finally {
886
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
887
+ }
888
+ };
889
+
890
+ /**
891
+ * @param {string} prev_hash_b64u
892
+ * @param {bigint} number
893
+ * @param {string} proposer_did
894
+ * @param {string} txs_json
895
+ * @returns {string}
896
+ */
897
+ exports.block_build_json = function(prev_hash_b64u, number, proposer_did, txs_json) {
898
+ let deferred4_0;
899
+ let deferred4_1;
900
+ try {
901
+ const ptr0 = passStringToWasm0(prev_hash_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
902
+ const len0 = WASM_VECTOR_LEN;
903
+ const ptr1 = passStringToWasm0(proposer_did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
904
+ const len1 = WASM_VECTOR_LEN;
905
+ const ptr2 = passStringToWasm0(txs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
906
+ const len2 = WASM_VECTOR_LEN;
907
+ const ret = wasm.block_build_json(ptr0, len0, number, ptr1, len1, ptr2, len2);
908
+ deferred4_0 = ret[0];
909
+ deferred4_1 = ret[1];
910
+ return getStringFromWasm0(ret[0], ret[1]);
911
+ } finally {
912
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
913
+ }
914
+ };
915
+
916
+ /**
917
+ * @param {string} ed25519_handle
918
+ * @param {string} header_json
919
+ * @param {string} opts_json
920
+ * @returns {string}
921
+ */
922
+ exports.block_sign_json = function(ed25519_handle, header_json, opts_json) {
923
+ let deferred4_0;
924
+ let deferred4_1;
925
+ try {
926
+ const ptr0 = passStringToWasm0(ed25519_handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
927
+ const len0 = WASM_VECTOR_LEN;
928
+ const ptr1 = passStringToWasm0(header_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
929
+ const len1 = WASM_VECTOR_LEN;
930
+ const ptr2 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
931
+ const len2 = WASM_VECTOR_LEN;
932
+ const ret = wasm.block_sign_json(ptr0, len0, ptr1, len1, ptr2, len2);
933
+ deferred4_0 = ret[0];
934
+ deferred4_1 = ret[1];
935
+ return getStringFromWasm0(ret[0], ret[1]);
936
+ } finally {
937
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
938
+ }
939
+ };
940
+
941
+ /**
942
+ * @param {string} block_json
943
+ * @param {string} opts_json
944
+ * @returns {string}
945
+ */
946
+ exports.block_verify_json = function(block_json, opts_json) {
947
+ let deferred3_0;
948
+ let deferred3_1;
949
+ try {
950
+ const ptr0 = passStringToWasm0(block_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
951
+ const len0 = WASM_VECTOR_LEN;
952
+ const ptr1 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
953
+ const len1 = WASM_VECTOR_LEN;
954
+ const ret = wasm.block_verify_json(ptr0, len0, ptr1, len1);
955
+ deferred3_0 = ret[0];
956
+ deferred3_1 = ret[1];
957
+ return getStringFromWasm0(ret[0], ret[1]);
958
+ } finally {
959
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
960
+ }
961
+ };
962
+
963
+ /**
964
+ * ---------- Manifest ----------
965
+ * @param {string} params_json
966
+ * @returns {string}
967
+ */
968
+ exports.doc_manifest_build_json = function(params_json) {
969
+ let deferred2_0;
970
+ let deferred2_1;
971
+ try {
972
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
973
+ const len0 = WASM_VECTOR_LEN;
974
+ const ret = wasm.doc_manifest_build_json(ptr0, len0);
975
+ deferred2_0 = ret[0];
976
+ deferred2_1 = ret[1];
977
+ return getStringFromWasm0(ret[0], ret[1]);
978
+ } finally {
979
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
980
+ }
981
+ };
982
+
983
+ /**
984
+ * @param {string} handle
985
+ * @param {string} manifest_json
986
+ * @param {string} opts_json
987
+ * @returns {string}
988
+ */
989
+ exports.doc_manifest_sign_json = function(handle, manifest_json, opts_json) {
990
+ let deferred4_0;
991
+ let deferred4_1;
992
+ try {
993
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
994
+ const len0 = WASM_VECTOR_LEN;
995
+ const ptr1 = passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
996
+ const len1 = WASM_VECTOR_LEN;
997
+ const ptr2 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
998
+ const len2 = WASM_VECTOR_LEN;
999
+ const ret = wasm.doc_manifest_sign_json(ptr0, len0, ptr1, len1, ptr2, len2);
1000
+ deferred4_0 = ret[0];
1001
+ deferred4_1 = ret[1];
1002
+ return getStringFromWasm0(ret[0], ret[1]);
1003
+ } finally {
1004
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1005
+ }
1006
+ };
1007
+
1008
+ /**
1009
+ * @param {string} manifest_json
1010
+ * @param {string} opts_json
1011
+ * @returns {string}
1012
+ */
1013
+ exports.doc_manifest_verify_json = function(manifest_json, opts_json) {
1014
+ let deferred3_0;
1015
+ let deferred3_1;
1016
+ try {
1017
+ const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1018
+ const len0 = WASM_VECTOR_LEN;
1019
+ const ptr1 = passStringToWasm0(opts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1020
+ const len1 = WASM_VECTOR_LEN;
1021
+ const ret = wasm.doc_manifest_verify_json(ptr0, len0, ptr1, len1);
1022
+ deferred3_0 = ret[0];
1023
+ deferred3_1 = ret[1];
1024
+ return getStringFromWasm0(ret[0], ret[1]);
1025
+ } finally {
1026
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1027
+ }
1028
+ };
1029
+
1030
+ /**
1031
+ * ---------- IPFS / CID ----------
1032
+ * @param {string} data_b64u
1033
+ * @param {string | null} [codec_hint]
1034
+ * @returns {string}
1035
+ */
1036
+ exports.ipfs_cid_v1_from_bytes_json = function(data_b64u, codec_hint) {
1037
+ let deferred3_0;
1038
+ let deferred3_1;
1039
+ try {
1040
+ const ptr0 = passStringToWasm0(data_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1041
+ const len0 = WASM_VECTOR_LEN;
1042
+ var ptr1 = isLikeNone(codec_hint) ? 0 : passStringToWasm0(codec_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1043
+ var len1 = WASM_VECTOR_LEN;
1044
+ const ret = wasm.ipfs_cid_v1_from_bytes_json(ptr0, len0, ptr1, len1);
1045
+ deferred3_0 = ret[0];
1046
+ deferred3_1 = ret[1];
1047
+ return getStringFromWasm0(ret[0], ret[1]);
1048
+ } finally {
1049
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1050
+ }
1051
+ };
1052
+
1053
+ /**
1054
+ * @param {string} multihash_b64u
1055
+ * @returns {string}
1056
+ */
1057
+ exports.ipfs_cid_v1_from_hash_json = function(multihash_b64u) {
1058
+ let deferred2_0;
1059
+ let deferred2_1;
1060
+ try {
1061
+ const ptr0 = passStringToWasm0(multihash_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1062
+ const len0 = WASM_VECTOR_LEN;
1063
+ const ret = wasm.ipfs_cid_v1_from_hash_json(ptr0, len0);
1064
+ deferred2_0 = ret[0];
1065
+ deferred2_1 = ret[1];
1066
+ return getStringFromWasm0(ret[0], ret[1]);
1067
+ } finally {
1068
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1069
+ }
1070
+ };
1071
+
1072
+ /**
1073
+ * ---------- Vault ----------
1074
+ * @param {string} passphrase
1075
+ * @param {string} salt_b64u
1076
+ * @param {string} params_json
1077
+ * @returns {string}
1078
+ */
1079
+ exports.vmk_from_passphrase_json = function(passphrase, salt_b64u, params_json) {
1080
+ let deferred4_0;
1081
+ let deferred4_1;
1082
+ try {
1083
+ const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1084
+ const len0 = WASM_VECTOR_LEN;
1085
+ const ptr1 = passStringToWasm0(salt_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1086
+ const len1 = WASM_VECTOR_LEN;
1087
+ const ptr2 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1088
+ const len2 = WASM_VECTOR_LEN;
1089
+ const ret = wasm.vmk_from_passphrase_json(ptr0, len0, ptr1, len1, ptr2, len2);
1090
+ deferred4_0 = ret[0];
1091
+ deferred4_1 = ret[1];
1092
+ return getStringFromWasm0(ret[0], ret[1]);
1093
+ } finally {
1094
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1095
+ }
1096
+ };
1097
+
1098
+ /**
1099
+ * @returns {string}
1100
+ */
1101
+ exports.vmk_random_json = function() {
1102
+ let deferred1_0;
1103
+ let deferred1_1;
1104
+ try {
1105
+ const ret = wasm.vmk_random_json();
1106
+ deferred1_0 = ret[0];
1107
+ deferred1_1 = ret[1];
1108
+ return getStringFromWasm0(ret[0], ret[1]);
1109
+ } finally {
1110
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1111
+ }
1112
+ };
1113
+
1114
+ /**
1115
+ * @param {string} vmk_json
1116
+ * @returns {string}
1117
+ */
1118
+ exports.vault_create_json = function(vmk_json) {
1119
+ let deferred2_0;
1120
+ let deferred2_1;
1121
+ try {
1122
+ const ptr0 = passStringToWasm0(vmk_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1123
+ const len0 = WASM_VECTOR_LEN;
1124
+ const ret = wasm.vault_create_json(ptr0, len0);
1125
+ deferred2_0 = ret[0];
1126
+ deferred2_1 = ret[1];
1127
+ return getStringFromWasm0(ret[0], ret[1]);
1128
+ } finally {
1129
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1130
+ }
1131
+ };
1132
+
1133
+ /**
1134
+ * @param {string} state_json
1135
+ * @param {string} vmk_json
1136
+ * @param {string} label
1137
+ * @param {string} ktype
1138
+ * @param {string} secret_b64u
1139
+ * @returns {string}
1140
+ */
1141
+ exports.vault_add_key_json = function(state_json, vmk_json, label, ktype, secret_b64u) {
1142
+ let deferred6_0;
1143
+ let deferred6_1;
1144
+ try {
1145
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1146
+ const len0 = WASM_VECTOR_LEN;
1147
+ const ptr1 = passStringToWasm0(vmk_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1148
+ const len1 = WASM_VECTOR_LEN;
1149
+ const ptr2 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1150
+ const len2 = WASM_VECTOR_LEN;
1151
+ const ptr3 = passStringToWasm0(ktype, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1152
+ const len3 = WASM_VECTOR_LEN;
1153
+ const ptr4 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1154
+ const len4 = WASM_VECTOR_LEN;
1155
+ const ret = wasm.vault_add_key_json(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
1156
+ deferred6_0 = ret[0];
1157
+ deferred6_1 = ret[1];
1158
+ return getStringFromWasm0(ret[0], ret[1]);
1159
+ } finally {
1160
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
1161
+ }
1162
+ };
1163
+
1164
+ /**
1165
+ * @param {string} state_json
1166
+ * @param {string} vmk_json
1167
+ * @param {string} label
1168
+ * @returns {string}
1169
+ */
1170
+ exports.vault_get_key_json = function(state_json, vmk_json, label) {
1171
+ let deferred4_0;
1172
+ let deferred4_1;
1173
+ try {
1174
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1175
+ const len0 = WASM_VECTOR_LEN;
1176
+ const ptr1 = passStringToWasm0(vmk_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1177
+ const len1 = WASM_VECTOR_LEN;
1178
+ const ptr2 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1179
+ const len2 = WASM_VECTOR_LEN;
1180
+ const ret = wasm.vault_get_key_json(ptr0, len0, ptr1, len1, ptr2, len2);
1181
+ deferred4_0 = ret[0];
1182
+ deferred4_1 = ret[1];
1183
+ return getStringFromWasm0(ret[0], ret[1]);
1184
+ } finally {
1185
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1186
+ }
1187
+ };
1188
+
1189
+ /**
1190
+ * @param {string} state_json
1191
+ * @param {string} vmk_json
1192
+ * @returns {string}
1193
+ */
1194
+ exports.vault_export_json = function(state_json, vmk_json) {
1195
+ let deferred3_0;
1196
+ let deferred3_1;
1197
+ try {
1198
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1199
+ const len0 = WASM_VECTOR_LEN;
1200
+ const ptr1 = passStringToWasm0(vmk_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1201
+ const len1 = WASM_VECTOR_LEN;
1202
+ const ret = wasm.vault_export_json(ptr0, len0, ptr1, len1);
1203
+ deferred3_0 = ret[0];
1204
+ deferred3_1 = ret[1];
1205
+ return getStringFromWasm0(ret[0], ret[1]);
1206
+ } finally {
1207
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1208
+ }
1209
+ };
1210
+
1211
+ /**
1212
+ * @param {string} armored
1213
+ * @param {string} vmk_json
1214
+ * @returns {string}
1215
+ */
1216
+ exports.vault_import_json = function(armored, vmk_json) {
1217
+ let deferred3_0;
1218
+ let deferred3_1;
1219
+ try {
1220
+ const ptr0 = passStringToWasm0(armored, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1221
+ const len0 = WASM_VECTOR_LEN;
1222
+ const ptr1 = passStringToWasm0(vmk_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1223
+ const len1 = WASM_VECTOR_LEN;
1224
+ const ret = wasm.vault_import_json(ptr0, len0, ptr1, len1);
1225
+ deferred3_0 = ret[0];
1226
+ deferred3_1 = ret[1];
1227
+ return getStringFromWasm0(ret[0], ret[1]);
1228
+ } finally {
1229
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1230
+ }
1231
+ };
1232
+
1233
+ exports.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
1234
+ const ret = arg0.call(arg1);
1235
+ return ret;
1236
+ }, arguments) };
1237
+
1238
+ exports.__wbg_call_a5400b25a865cfd8 = function() { return handleError(function (arg0, arg1, arg2) {
1239
+ const ret = arg0.call(arg1, arg2);
1240
+ return ret;
1241
+ }, arguments) };
1242
+
1243
+ exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
1244
+ const ret = arg0.crypto;
1245
+ return ret;
1246
+ };
1247
+
1248
+ exports.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function() { return handleError(function (arg0, arg1) {
1249
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1250
+ }, arguments) };
1251
+
1252
+ exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
1253
+ arg0.getRandomValues(arg1);
1254
+ }, arguments) };
1255
+
1256
+ exports.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
1257
+ const ret = arg0.length;
1258
+ return ret;
1259
+ };
1260
+
1261
+ exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
1262
+ const ret = arg0.msCrypto;
1263
+ return ret;
1264
+ };
1265
+
1266
+ exports.__wbg_newnoargs_254190557c45b4ec = function(arg0, arg1) {
1267
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1268
+ return ret;
1269
+ };
1270
+
1271
+ exports.__wbg_newwithlength_a167dcc7aaa3ba77 = function(arg0) {
1272
+ const ret = new Uint8Array(arg0 >>> 0);
1273
+ return ret;
1274
+ };
1275
+
1276
+ exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
1277
+ const ret = arg0.node;
1278
+ return ret;
1279
+ };
1280
+
1281
+ exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
1282
+ const ret = arg0.process;
1283
+ return ret;
1284
+ };
1285
+
1286
+ exports.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
1287
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1288
+ };
1289
+
1290
+ exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
1291
+ arg0.randomFillSync(arg1);
1292
+ }, arguments) };
1293
+
1294
+ exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
1295
+ const ret = module.require;
1296
+ return ret;
1297
+ }, arguments) };
1298
+
1299
+ exports.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12 = function() {
1300
+ const ret = typeof global === 'undefined' ? null : global;
1301
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1302
+ };
1303
+
1304
+ exports.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184 = function() {
1305
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1306
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1307
+ };
1308
+
1309
+ exports.__wbg_static_accessor_SELF_995b214ae681ff99 = function() {
1310
+ const ret = typeof self === 'undefined' ? null : self;
1311
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1312
+ };
1313
+
1314
+ exports.__wbg_static_accessor_WINDOW_cde3890479c675ea = function() {
1315
+ const ret = typeof window === 'undefined' ? null : window;
1316
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1317
+ };
1318
+
1319
+ exports.__wbg_subarray_70fd07feefe14294 = function(arg0, arg1, arg2) {
1320
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1321
+ return ret;
1322
+ };
1323
+
1324
+ exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
1325
+ const ret = arg0.versions;
1326
+ return ret;
1327
+ };
1328
+
1329
+ exports.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
1330
+ const ret = typeof(arg0) === 'function';
1331
+ return ret;
1332
+ };
1333
+
1334
+ exports.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
1335
+ const val = arg0;
1336
+ const ret = typeof(val) === 'object' && val !== null;
1337
+ return ret;
1338
+ };
1339
+
1340
+ exports.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
1341
+ const ret = typeof(arg0) === 'string';
1342
+ return ret;
1343
+ };
1344
+
1345
+ exports.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
1346
+ const ret = arg0 === undefined;
1347
+ return ret;
1348
+ };
1349
+
1350
+ exports.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
1351
+ throw new Error(getStringFromWasm0(arg0, arg1));
1352
+ };
1353
+
1354
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1355
+ // Cast intrinsic for `Ref(String) -> Externref`.
1356
+ const ret = getStringFromWasm0(arg0, arg1);
1357
+ return ret;
1358
+ };
1359
+
1360
+ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1361
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1362
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1363
+ return ret;
1364
+ };
1365
+
1366
+ exports.__wbindgen_init_externref_table = function() {
1367
+ const table = wasm.__wbindgen_export_2;
1368
+ const offset = table.grow(4);
1369
+ table.set(0, undefined);
1370
+ table.set(offset + 0, undefined);
1371
+ table.set(offset + 1, null);
1372
+ table.set(offset + 2, true);
1373
+ table.set(offset + 3, false);
1374
+ ;
1375
+ };
1376
+
1377
+ const wasmPath = `${__dirname}/superid_agent_core_bg.wasm`;
1378
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1379
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1380
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
1381
+
1382
+ wasm.__wbindgen_start();
1383
+