@learncard/core 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1070 @@
1
+ let wasm;
2
+
3
+ const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
4
+
5
+ cachedTextDecoder.decode();
6
+
7
+ let cachegetUint8Memory0 = null;
8
+ function getUint8Memory0() {
9
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
10
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
11
+ }
12
+ return cachegetUint8Memory0;
13
+ }
14
+
15
+ function getStringFromWasm0(ptr, len) {
16
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
17
+ }
18
+
19
+ const heap = new Array(32).fill(undefined);
20
+
21
+ heap.push(undefined, null, true, false);
22
+
23
+ let heap_next = heap.length;
24
+
25
+ function addHeapObject(obj) {
26
+ if (heap_next === heap.length) heap.push(heap.length + 1);
27
+ const idx = heap_next;
28
+ heap_next = heap[idx];
29
+
30
+ heap[idx] = obj;
31
+ return idx;
32
+ }
33
+
34
+ function getObject(idx) {
35
+ return heap[idx];
36
+ }
37
+
38
+ function dropObject(idx) {
39
+ if (idx < 36) return;
40
+ heap[idx] = heap_next;
41
+ heap_next = idx;
42
+ }
43
+
44
+ function takeObject(idx) {
45
+ const ret = getObject(idx);
46
+ dropObject(idx);
47
+ return ret;
48
+ }
49
+
50
+ let WASM_VECTOR_LEN = 0;
51
+
52
+ const cachedTextEncoder = new TextEncoder('utf-8');
53
+
54
+ const encodeString =
55
+ typeof cachedTextEncoder.encodeInto === 'function'
56
+ ? function (arg, view) {
57
+ return cachedTextEncoder.encodeInto(arg, view);
58
+ }
59
+ : function (arg, view) {
60
+ const buf = cachedTextEncoder.encode(arg);
61
+ view.set(buf);
62
+ return {
63
+ read: arg.length,
64
+ written: buf.length,
65
+ };
66
+ };
67
+
68
+ function passStringToWasm0(arg, malloc, realloc) {
69
+ if (realloc === undefined) {
70
+ const buf = cachedTextEncoder.encode(arg);
71
+ const ptr = malloc(buf.length);
72
+ getUint8Memory0()
73
+ .subarray(ptr, ptr + buf.length)
74
+ .set(buf);
75
+ WASM_VECTOR_LEN = buf.length;
76
+ return ptr;
77
+ }
78
+
79
+ let len = arg.length;
80
+ let ptr = malloc(len);
81
+
82
+ const mem = getUint8Memory0();
83
+
84
+ let offset = 0;
85
+
86
+ for (; offset < len; offset++) {
87
+ const code = arg.charCodeAt(offset);
88
+ if (code > 0x7f) break;
89
+ mem[ptr + offset] = code;
90
+ }
91
+
92
+ if (offset !== len) {
93
+ if (offset !== 0) {
94
+ arg = arg.slice(offset);
95
+ }
96
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3));
97
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
98
+ const ret = encodeString(arg, view);
99
+
100
+ offset += ret.written;
101
+ }
102
+
103
+ WASM_VECTOR_LEN = offset;
104
+ return ptr;
105
+ }
106
+
107
+ function isLikeNone(x) {
108
+ return x === undefined || x === null;
109
+ }
110
+
111
+ let cachegetInt32Memory0 = null;
112
+ function getInt32Memory0() {
113
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
114
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
115
+ }
116
+ return cachegetInt32Memory0;
117
+ }
118
+
119
+ function debugString(val) {
120
+ // primitive types
121
+ const type = typeof val;
122
+ if (type == 'number' || type == 'boolean' || val == null) {
123
+ return `${val}`;
124
+ }
125
+ if (type == 'string') {
126
+ return `"${val}"`;
127
+ }
128
+ if (type == 'symbol') {
129
+ const description = val.description;
130
+ if (description == null) {
131
+ return 'Symbol';
132
+ } else {
133
+ return `Symbol(${description})`;
134
+ }
135
+ }
136
+ if (type == 'function') {
137
+ const name = val.name;
138
+ if (typeof name == 'string' && name.length > 0) {
139
+ return `Function(${name})`;
140
+ } else {
141
+ return 'Function';
142
+ }
143
+ }
144
+ // objects
145
+ if (Array.isArray(val)) {
146
+ const length = val.length;
147
+ let debug = '[';
148
+ if (length > 0) {
149
+ debug += debugString(val[0]);
150
+ }
151
+ for (let i = 1; i < length; i++) {
152
+ debug += ', ' + debugString(val[i]);
153
+ }
154
+ debug += ']';
155
+ return debug;
156
+ }
157
+ // Test for built-in
158
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
159
+ let className;
160
+ if (builtInMatches.length > 1) {
161
+ className = builtInMatches[1];
162
+ } else {
163
+ // Failed to match the standard '[object ClassName]'
164
+ return toString.call(val);
165
+ }
166
+ if (className == 'Object') {
167
+ // we're a user defined class or Object
168
+ // JSON.stringify avoids problems with cycles, and is generally much
169
+ // easier than looping through ownProperties of `val`.
170
+ try {
171
+ return 'Object(' + JSON.stringify(val) + ')';
172
+ } catch (_) {
173
+ return 'Object';
174
+ }
175
+ }
176
+ // errors
177
+ if (val instanceof Error) {
178
+ return `${val.name}: ${val.message}\n${val.stack}`;
179
+ }
180
+ // TODO we could test for more things here, like `Set`s and `Map`s.
181
+ return className;
182
+ }
183
+
184
+ function makeMutClosure(arg0, arg1, dtor, f) {
185
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
186
+ const real = (...args) => {
187
+ // First up with a closure we increment the internal reference
188
+ // count. This ensures that the Rust closure environment won't
189
+ // be deallocated while we're invoking it.
190
+ state.cnt++;
191
+ const a = state.a;
192
+ state.a = 0;
193
+ try {
194
+ return f(a, state.b, ...args);
195
+ } finally {
196
+ if (--state.cnt === 0) {
197
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
198
+ } else {
199
+ state.a = a;
200
+ }
201
+ }
202
+ };
203
+ real.original = state;
204
+
205
+ return real;
206
+ }
207
+ function __wbg_adapter_24(arg0, arg1, arg2) {
208
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(
209
+ arg0,
210
+ arg1,
211
+ addHeapObject(arg2)
212
+ );
213
+ }
214
+
215
+ /**
216
+ * @returns {string}
217
+ */
218
+ export function getVersion() {
219
+ try {
220
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
221
+ wasm.getVersion(retptr);
222
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
223
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
224
+ return getStringFromWasm0(r0, r1);
225
+ } finally {
226
+ wasm.__wbindgen_add_to_stack_pointer(16);
227
+ wasm.__wbindgen_free(r0, r1);
228
+ }
229
+ }
230
+
231
+ /**
232
+ * @param {string} did
233
+ * @param {string} input_metadata
234
+ * @returns {Promise<any>}
235
+ */
236
+ export function resolveDID(did, input_metadata) {
237
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
+ const len0 = WASM_VECTOR_LEN;
239
+ const ptr1 = passStringToWasm0(input_metadata, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
+ const len1 = WASM_VECTOR_LEN;
241
+ const ret = wasm.resolveDID(ptr0, len0, ptr1, len1);
242
+ return takeObject(ret);
243
+ }
244
+
245
+ /**
246
+ * @returns {string}
247
+ */
248
+ export function generateEd25519Key() {
249
+ try {
250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
251
+ wasm.generateEd25519Key(retptr);
252
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
253
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
254
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
255
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
256
+ var ptr0 = r0;
257
+ var len0 = r1;
258
+ if (r3) {
259
+ ptr0 = 0;
260
+ len0 = 0;
261
+ throw takeObject(r2);
262
+ }
263
+ return getStringFromWasm0(ptr0, len0);
264
+ } finally {
265
+ wasm.__wbindgen_add_to_stack_pointer(16);
266
+ wasm.__wbindgen_free(ptr0, len0);
267
+ }
268
+ }
269
+
270
+ function passArray8ToWasm0(arg, malloc) {
271
+ const ptr = malloc(arg.length * 1);
272
+ getUint8Memory0().set(arg, ptr / 1);
273
+ WASM_VECTOR_LEN = arg.length;
274
+ return ptr;
275
+ }
276
+ /**
277
+ * @param {Uint8Array} bytes
278
+ * @returns {string}
279
+ */
280
+ export function generateEd25519KeyFromBytes(bytes) {
281
+ try {
282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
283
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
286
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
287
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
288
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
289
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
290
+ var ptr1 = r0;
291
+ var len1 = r1;
292
+ if (r3) {
293
+ ptr1 = 0;
294
+ len1 = 0;
295
+ throw takeObject(r2);
296
+ }
297
+ return getStringFromWasm0(ptr1, len1);
298
+ } finally {
299
+ wasm.__wbindgen_add_to_stack_pointer(16);
300
+ wasm.__wbindgen_free(ptr1, len1);
301
+ }
302
+ }
303
+
304
+ /**
305
+ * @param {string} method_pattern
306
+ * @param {string} jwk
307
+ * @returns {string}
308
+ */
309
+ export function keyToDID(method_pattern, jwk) {
310
+ try {
311
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
312
+ const ptr0 = passStringToWasm0(
313
+ method_pattern,
314
+ wasm.__wbindgen_malloc,
315
+ wasm.__wbindgen_realloc
316
+ );
317
+ const len0 = WASM_VECTOR_LEN;
318
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
319
+ const len1 = WASM_VECTOR_LEN;
320
+ wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
321
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
322
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
323
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
324
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
325
+ var ptr2 = r0;
326
+ var len2 = r1;
327
+ if (r3) {
328
+ ptr2 = 0;
329
+ len2 = 0;
330
+ throw takeObject(r2);
331
+ }
332
+ return getStringFromWasm0(ptr2, len2);
333
+ } finally {
334
+ wasm.__wbindgen_add_to_stack_pointer(16);
335
+ wasm.__wbindgen_free(ptr2, len2);
336
+ }
337
+ }
338
+
339
+ /**
340
+ * @param {string} method_pattern
341
+ * @param {string} jwk
342
+ * @returns {Promise<any>}
343
+ */
344
+ export function keyToVerificationMethod(method_pattern, jwk) {
345
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
+ const len0 = WASM_VECTOR_LEN;
347
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
+ const len1 = WASM_VECTOR_LEN;
349
+ const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
350
+ return takeObject(ret);
351
+ }
352
+
353
+ /**
354
+ * @param {string} credential
355
+ * @param {string} proof_options
356
+ * @param {string} key
357
+ * @returns {Promise<any>}
358
+ */
359
+ export function issueCredential(credential, proof_options, key) {
360
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ const len0 = WASM_VECTOR_LEN;
362
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
+ const len1 = WASM_VECTOR_LEN;
364
+ const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
365
+ const len2 = WASM_VECTOR_LEN;
366
+ const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
367
+ return takeObject(ret);
368
+ }
369
+
370
+ /**
371
+ * @param {string} credential
372
+ * @param {string} linked_data_proof_options
373
+ * @param {string} public_key
374
+ * @returns {Promise<any>}
375
+ */
376
+ export function prepareIssueCredential(credential, linked_data_proof_options, public_key) {
377
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ const ptr1 = passStringToWasm0(
380
+ linked_data_proof_options,
381
+ wasm.__wbindgen_malloc,
382
+ wasm.__wbindgen_realloc
383
+ );
384
+ const len1 = WASM_VECTOR_LEN;
385
+ const ptr2 = passStringToWasm0(public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
+ const len2 = WASM_VECTOR_LEN;
387
+ const ret = wasm.prepareIssueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
388
+ return takeObject(ret);
389
+ }
390
+
391
+ /**
392
+ * @param {string} credential
393
+ * @param {string} preparation
394
+ * @param {string} signature
395
+ * @returns {Promise<any>}
396
+ */
397
+ export function completeIssueCredential(credential, preparation, signature) {
398
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
399
+ const len0 = WASM_VECTOR_LEN;
400
+ const ptr1 = passStringToWasm0(preparation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
401
+ const len1 = WASM_VECTOR_LEN;
402
+ const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
+ const len2 = WASM_VECTOR_LEN;
404
+ const ret = wasm.completeIssueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
405
+ return takeObject(ret);
406
+ }
407
+
408
+ /**
409
+ * @param {string} vc
410
+ * @param {string} proof_options
411
+ * @returns {Promise<any>}
412
+ */
413
+ export function verifyCredential(vc, proof_options) {
414
+ const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
415
+ const len0 = WASM_VECTOR_LEN;
416
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
417
+ const len1 = WASM_VECTOR_LEN;
418
+ const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
419
+ return takeObject(ret);
420
+ }
421
+
422
+ /**
423
+ * @param {string} presentation
424
+ * @param {string} proof_options
425
+ * @param {string} key
426
+ * @returns {Promise<any>}
427
+ */
428
+ export function issuePresentation(presentation, proof_options, key) {
429
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
+ const len0 = WASM_VECTOR_LEN;
431
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
432
+ const len1 = WASM_VECTOR_LEN;
433
+ const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
434
+ const len2 = WASM_VECTOR_LEN;
435
+ const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
436
+ return takeObject(ret);
437
+ }
438
+
439
+ /**
440
+ * @param {string} presentation
441
+ * @param {string} linked_data_proof_options
442
+ * @param {string} public_key
443
+ * @returns {Promise<any>}
444
+ */
445
+ export function prepareIssuePresentation(presentation, linked_data_proof_options, public_key) {
446
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
447
+ const len0 = WASM_VECTOR_LEN;
448
+ const ptr1 = passStringToWasm0(
449
+ linked_data_proof_options,
450
+ wasm.__wbindgen_malloc,
451
+ wasm.__wbindgen_realloc
452
+ );
453
+ const len1 = WASM_VECTOR_LEN;
454
+ const ptr2 = passStringToWasm0(public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
455
+ const len2 = WASM_VECTOR_LEN;
456
+ const ret = wasm.prepareIssuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
457
+ return takeObject(ret);
458
+ }
459
+
460
+ /**
461
+ * @param {string} presentation
462
+ * @param {string} preparation
463
+ * @param {string} signature
464
+ * @returns {Promise<any>}
465
+ */
466
+ export function completeIssuePresentation(presentation, preparation, signature) {
467
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ const len0 = WASM_VECTOR_LEN;
469
+ const ptr1 = passStringToWasm0(preparation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
470
+ const len1 = WASM_VECTOR_LEN;
471
+ const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len2 = WASM_VECTOR_LEN;
473
+ const ret = wasm.completeIssuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
474
+ return takeObject(ret);
475
+ }
476
+
477
+ /**
478
+ * @param {string} vp
479
+ * @param {string} proof_options
480
+ * @returns {Promise<any>}
481
+ */
482
+ export function verifyPresentation(vp, proof_options) {
483
+ const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
484
+ const len0 = WASM_VECTOR_LEN;
485
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
+ const len1 = WASM_VECTOR_LEN;
487
+ const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
488
+ return takeObject(ret);
489
+ }
490
+
491
+ /**
492
+ * @param {string} holder
493
+ * @param {string} linked_data_proof_options
494
+ * @param {string} key
495
+ * @returns {Promise<any>}
496
+ */
497
+ export function DIDAuth(holder, linked_data_proof_options, key) {
498
+ const ptr0 = passStringToWasm0(holder, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
499
+ const len0 = WASM_VECTOR_LEN;
500
+ const ptr1 = passStringToWasm0(
501
+ linked_data_proof_options,
502
+ wasm.__wbindgen_malloc,
503
+ wasm.__wbindgen_realloc
504
+ );
505
+ const len1 = WASM_VECTOR_LEN;
506
+ const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
+ const len2 = WASM_VECTOR_LEN;
508
+ const ret = wasm.DIDAuth(ptr0, len0, ptr1, len1, ptr2, len2);
509
+ return takeObject(ret);
510
+ }
511
+
512
+ /**
513
+ * @param {string} tz
514
+ * @returns {Promise<any>}
515
+ */
516
+ export function JWKFromTezos(tz) {
517
+ const ptr0 = passStringToWasm0(tz, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
518
+ const len0 = WASM_VECTOR_LEN;
519
+ const ret = wasm.JWKFromTezos(ptr0, len0);
520
+ return takeObject(ret);
521
+ }
522
+
523
+ /**
524
+ * @param {string} capability
525
+ * @param {string} linked_data_proof_options
526
+ * @param {string} parents
527
+ * @param {string} key
528
+ * @returns {Promise<any>}
529
+ */
530
+ export function delegateCapability(capability, linked_data_proof_options, parents, key) {
531
+ const ptr0 = passStringToWasm0(capability, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
532
+ const len0 = WASM_VECTOR_LEN;
533
+ const ptr1 = passStringToWasm0(
534
+ linked_data_proof_options,
535
+ wasm.__wbindgen_malloc,
536
+ wasm.__wbindgen_realloc
537
+ );
538
+ const len1 = WASM_VECTOR_LEN;
539
+ const ptr2 = passStringToWasm0(parents, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
540
+ const len2 = WASM_VECTOR_LEN;
541
+ const ptr3 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
542
+ const len3 = WASM_VECTOR_LEN;
543
+ const ret = wasm.delegateCapability(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
544
+ return takeObject(ret);
545
+ }
546
+
547
+ /**
548
+ * @param {string} capability
549
+ * @param {string} linked_data_proof_options
550
+ * @param {string} parents
551
+ * @param {string} public_key
552
+ * @returns {Promise<any>}
553
+ */
554
+ export function prepareDelegateCapability(
555
+ capability,
556
+ linked_data_proof_options,
557
+ parents,
558
+ public_key
559
+ ) {
560
+ const ptr0 = passStringToWasm0(capability, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ const ptr1 = passStringToWasm0(
563
+ linked_data_proof_options,
564
+ wasm.__wbindgen_malloc,
565
+ wasm.__wbindgen_realloc
566
+ );
567
+ const len1 = WASM_VECTOR_LEN;
568
+ const ptr2 = passStringToWasm0(parents, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
569
+ const len2 = WASM_VECTOR_LEN;
570
+ const ptr3 = passStringToWasm0(public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
+ const len3 = WASM_VECTOR_LEN;
572
+ const ret = wasm.prepareDelegateCapability(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
573
+ return takeObject(ret);
574
+ }
575
+
576
+ /**
577
+ * @param {string} capability
578
+ * @param {string} preparation
579
+ * @param {string} signature
580
+ * @returns {Promise<any>}
581
+ */
582
+ export function completeDelegateCapability(capability, preparation, signature) {
583
+ const ptr0 = passStringToWasm0(capability, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
584
+ const len0 = WASM_VECTOR_LEN;
585
+ const ptr1 = passStringToWasm0(preparation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
586
+ const len1 = WASM_VECTOR_LEN;
587
+ const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
588
+ const len2 = WASM_VECTOR_LEN;
589
+ const ret = wasm.completeDelegateCapability(ptr0, len0, ptr1, len1, ptr2, len2);
590
+ return takeObject(ret);
591
+ }
592
+
593
+ /**
594
+ * @param {string} delegation
595
+ * @returns {Promise<any>}
596
+ */
597
+ export function verifyDelegation(delegation) {
598
+ const ptr0 = passStringToWasm0(delegation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
599
+ const len0 = WASM_VECTOR_LEN;
600
+ const ret = wasm.verifyDelegation(ptr0, len0);
601
+ return takeObject(ret);
602
+ }
603
+
604
+ /**
605
+ * @param {string} invocation
606
+ * @param {string} target_id
607
+ * @param {string} linked_data_proof_options
608
+ * @param {string} key
609
+ * @returns {Promise<any>}
610
+ */
611
+ export function invokeCapability(invocation, target_id, linked_data_proof_options, key) {
612
+ const ptr0 = passStringToWasm0(invocation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
613
+ const len0 = WASM_VECTOR_LEN;
614
+ const ptr1 = passStringToWasm0(target_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
615
+ const len1 = WASM_VECTOR_LEN;
616
+ const ptr2 = passStringToWasm0(
617
+ linked_data_proof_options,
618
+ wasm.__wbindgen_malloc,
619
+ wasm.__wbindgen_realloc
620
+ );
621
+ const len2 = WASM_VECTOR_LEN;
622
+ const ptr3 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
623
+ const len3 = WASM_VECTOR_LEN;
624
+ const ret = wasm.invokeCapability(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
625
+ return takeObject(ret);
626
+ }
627
+
628
+ /**
629
+ * @param {string} invocation
630
+ * @param {string} target_id
631
+ * @param {string} linked_data_proof_options
632
+ * @param {string} public_key
633
+ * @returns {Promise<any>}
634
+ */
635
+ export function prepareInvokeCapability(
636
+ invocation,
637
+ target_id,
638
+ linked_data_proof_options,
639
+ public_key
640
+ ) {
641
+ const ptr0 = passStringToWasm0(invocation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
642
+ const len0 = WASM_VECTOR_LEN;
643
+ const ptr1 = passStringToWasm0(target_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
644
+ const len1 = WASM_VECTOR_LEN;
645
+ const ptr2 = passStringToWasm0(
646
+ linked_data_proof_options,
647
+ wasm.__wbindgen_malloc,
648
+ wasm.__wbindgen_realloc
649
+ );
650
+ const len2 = WASM_VECTOR_LEN;
651
+ const ptr3 = passStringToWasm0(public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
652
+ const len3 = WASM_VECTOR_LEN;
653
+ const ret = wasm.prepareInvokeCapability(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
654
+ return takeObject(ret);
655
+ }
656
+
657
+ /**
658
+ * @param {string} invocation
659
+ * @param {string} preparation
660
+ * @param {string} signature
661
+ * @returns {Promise<any>}
662
+ */
663
+ export function completeInvokeCapability(invocation, preparation, signature) {
664
+ const ptr0 = passStringToWasm0(invocation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
665
+ const len0 = WASM_VECTOR_LEN;
666
+ const ptr1 = passStringToWasm0(preparation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
667
+ const len1 = WASM_VECTOR_LEN;
668
+ const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
669
+ const len2 = WASM_VECTOR_LEN;
670
+ const ret = wasm.completeInvokeCapability(ptr0, len0, ptr1, len1, ptr2, len2);
671
+ return takeObject(ret);
672
+ }
673
+
674
+ /**
675
+ * @param {string} invocation
676
+ * @returns {Promise<any>}
677
+ */
678
+ export function verifyInvocationSignature(invocation) {
679
+ const ptr0 = passStringToWasm0(invocation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
680
+ const len0 = WASM_VECTOR_LEN;
681
+ const ret = wasm.verifyInvocationSignature(ptr0, len0);
682
+ return takeObject(ret);
683
+ }
684
+
685
+ /**
686
+ * @param {string} invocation
687
+ * @param {string} delegation
688
+ * @returns {Promise<any>}
689
+ */
690
+ export function verifyInvocation(invocation, delegation) {
691
+ const ptr0 = passStringToWasm0(invocation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
692
+ const len0 = WASM_VECTOR_LEN;
693
+ const ptr1 = passStringToWasm0(delegation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
694
+ const len1 = WASM_VECTOR_LEN;
695
+ const ret = wasm.verifyInvocation(ptr0, len0, ptr1, len1);
696
+ return takeObject(ret);
697
+ }
698
+
699
+ function handleError(f, args) {
700
+ try {
701
+ return f.apply(this, args);
702
+ } catch (e) {
703
+ wasm.__wbindgen_exn_store(addHeapObject(e));
704
+ }
705
+ }
706
+
707
+ function getArrayU8FromWasm0(ptr, len) {
708
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
709
+ }
710
+ function __wbg_adapter_108(arg0, arg1, arg2, arg3) {
711
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(
712
+ arg0,
713
+ arg1,
714
+ addHeapObject(arg2),
715
+ addHeapObject(arg3)
716
+ );
717
+ }
718
+
719
+ async function load(module, imports) {
720
+ if (typeof Response === 'function' && module instanceof Response) {
721
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
722
+ try {
723
+ return await WebAssembly.instantiateStreaming(module, imports);
724
+ } catch (e) {
725
+ if (module.headers.get('Content-Type') != 'application/wasm') {
726
+ console.warn(
727
+ '`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n',
728
+ e
729
+ );
730
+ } else {
731
+ throw e;
732
+ }
733
+ }
734
+ }
735
+
736
+ const bytes = await module.arrayBuffer();
737
+ return await WebAssembly.instantiate(bytes, imports);
738
+ } else {
739
+ const instance = await WebAssembly.instantiate(module, imports);
740
+
741
+ if (instance instanceof WebAssembly.Instance) {
742
+ return { instance, module };
743
+ } else {
744
+ return instance;
745
+ }
746
+ }
747
+ }
748
+
749
+ async function init(input) {
750
+ if (typeof input === 'undefined') {
751
+ // input = new URL('didkit_wasm_bg.wasm', import.meta.url);
752
+ }
753
+ const imports = {};
754
+ imports.wbg = {};
755
+ imports.wbg.__wbindgen_string_new = function (arg0, arg1) {
756
+ const ret = getStringFromWasm0(arg0, arg1);
757
+ return addHeapObject(ret);
758
+ };
759
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
760
+ takeObject(arg0);
761
+ };
762
+ imports.wbg.__wbindgen_cb_drop = function (arg0) {
763
+ const obj = takeObject(arg0).original;
764
+ if (obj.cnt-- == 1) {
765
+ obj.a = 0;
766
+ return true;
767
+ }
768
+ const ret = false;
769
+ return ret;
770
+ };
771
+ imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
772
+ const ret = getObject(arg0);
773
+ return addHeapObject(ret);
774
+ };
775
+ imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function (arg0) {
776
+ const ret = fetch(getObject(arg0));
777
+ return addHeapObject(ret);
778
+ };
779
+ imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function (arg0, arg1) {
780
+ const ret = getObject(arg0).fetch(getObject(arg1));
781
+ return addHeapObject(ret);
782
+ };
783
+ imports.wbg.__wbg_new_89d7f088c1c45353 = function () {
784
+ return handleError(function () {
785
+ const ret = new Headers();
786
+ return addHeapObject(ret);
787
+ }, arguments);
788
+ };
789
+ imports.wbg.__wbg_append_f4f93bc73c45ee3e = function () {
790
+ return handleError(function (arg0, arg1, arg2, arg3, arg4) {
791
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
792
+ }, arguments);
793
+ };
794
+ imports.wbg.__wbindgen_string_get = function (arg0, arg1) {
795
+ const obj = getObject(arg1);
796
+ const ret = typeof obj === 'string' ? obj : undefined;
797
+ var ptr0 = isLikeNone(ret)
798
+ ? 0
799
+ : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
800
+ var len0 = WASM_VECTOR_LEN;
801
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
802
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
803
+ };
804
+ imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function (arg0) {
805
+ const ret = getObject(arg0) instanceof Response;
806
+ return ret;
807
+ };
808
+ imports.wbg.__wbg_url_06c0f822d68d195c = function (arg0, arg1) {
809
+ const ret = getObject(arg1).url;
810
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
811
+ const len0 = WASM_VECTOR_LEN;
812
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
813
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
814
+ };
815
+ imports.wbg.__wbg_status_600fd8b881393898 = function (arg0) {
816
+ const ret = getObject(arg0).status;
817
+ return ret;
818
+ };
819
+ imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function (arg0) {
820
+ const ret = getObject(arg0).headers;
821
+ return addHeapObject(ret);
822
+ };
823
+ imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function () {
824
+ return handleError(function (arg0) {
825
+ const ret = getObject(arg0).arrayBuffer();
826
+ return addHeapObject(ret);
827
+ }, arguments);
828
+ };
829
+ imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function () {
830
+ return handleError(function (arg0, arg1, arg2) {
831
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
832
+ return addHeapObject(ret);
833
+ }, arguments);
834
+ };
835
+ imports.wbg.__wbindgen_is_object = function (arg0) {
836
+ const val = getObject(arg0);
837
+ const ret = typeof val === 'object' && val !== null;
838
+ return ret;
839
+ };
840
+ imports.wbg.__wbg_self_86b4b13392c7af56 = function () {
841
+ return handleError(function () {
842
+ const ret = self.self;
843
+ return addHeapObject(ret);
844
+ }, arguments);
845
+ };
846
+ imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function (arg0) {
847
+ const ret = getObject(arg0).crypto;
848
+ return addHeapObject(ret);
849
+ };
850
+ imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function (arg0) {
851
+ const ret = getObject(arg0).msCrypto;
852
+ return addHeapObject(ret);
853
+ };
854
+ imports.wbg.__wbindgen_is_undefined = function (arg0) {
855
+ const ret = getObject(arg0) === undefined;
856
+ return ret;
857
+ };
858
+ imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function () {
859
+ const ret = module;
860
+ return addHeapObject(ret);
861
+ };
862
+ imports.wbg.__wbg_require_f5521a5b85ad2542 = function (arg0, arg1, arg2) {
863
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
864
+ return addHeapObject(ret);
865
+ };
866
+ imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function (arg0) {
867
+ const ret = getObject(arg0).getRandomValues;
868
+ return addHeapObject(ret);
869
+ };
870
+ imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function (arg0, arg1) {
871
+ getObject(arg0).getRandomValues(getObject(arg1));
872
+ };
873
+ imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function (arg0, arg1, arg2) {
874
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
875
+ };
876
+ imports.wbg.__wbindgen_is_function = function (arg0) {
877
+ const ret = typeof getObject(arg0) === 'function';
878
+ return ret;
879
+ };
880
+ imports.wbg.__wbg_newnoargs_e23b458e372830de = function (arg0, arg1) {
881
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
882
+ return addHeapObject(ret);
883
+ };
884
+ imports.wbg.__wbg_next_cabb70b365520721 = function (arg0) {
885
+ const ret = getObject(arg0).next;
886
+ return addHeapObject(ret);
887
+ };
888
+ imports.wbg.__wbg_next_bf3d83fc18df496e = function () {
889
+ return handleError(function (arg0) {
890
+ const ret = getObject(arg0).next();
891
+ return addHeapObject(ret);
892
+ }, arguments);
893
+ };
894
+ imports.wbg.__wbg_done_040f966faa9a72b3 = function (arg0) {
895
+ const ret = getObject(arg0).done;
896
+ return ret;
897
+ };
898
+ imports.wbg.__wbg_value_419afbd9b9574c4c = function (arg0) {
899
+ const ret = getObject(arg0).value;
900
+ return addHeapObject(ret);
901
+ };
902
+ imports.wbg.__wbg_iterator_4832ef1f15b0382b = function () {
903
+ const ret = Symbol.iterator;
904
+ return addHeapObject(ret);
905
+ };
906
+ imports.wbg.__wbg_get_a9cab131e3152c49 = function () {
907
+ return handleError(function (arg0, arg1) {
908
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
909
+ return addHeapObject(ret);
910
+ }, arguments);
911
+ };
912
+ imports.wbg.__wbg_call_ae78342adc33730a = function () {
913
+ return handleError(function (arg0, arg1) {
914
+ const ret = getObject(arg0).call(getObject(arg1));
915
+ return addHeapObject(ret);
916
+ }, arguments);
917
+ };
918
+ imports.wbg.__wbg_new_36359baae5a47e27 = function () {
919
+ const ret = new Object();
920
+ return addHeapObject(ret);
921
+ };
922
+ imports.wbg.__wbg_call_3ed288a247f13ea5 = function () {
923
+ return handleError(function (arg0, arg1, arg2) {
924
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
925
+ return addHeapObject(ret);
926
+ }, arguments);
927
+ };
928
+ imports.wbg.__wbg_getTime_bffb1c09df09618b = function (arg0) {
929
+ const ret = getObject(arg0).getTime();
930
+ return ret;
931
+ };
932
+ imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function () {
933
+ const ret = new Date();
934
+ return addHeapObject(ret);
935
+ };
936
+ imports.wbg.__wbg_new_37705eed627d5ed9 = function (arg0, arg1) {
937
+ try {
938
+ var state0 = { a: arg0, b: arg1 };
939
+ var cb0 = (arg0, arg1) => {
940
+ const a = state0.a;
941
+ state0.a = 0;
942
+ try {
943
+ return __wbg_adapter_108(a, state0.b, arg0, arg1);
944
+ } finally {
945
+ state0.a = a;
946
+ }
947
+ };
948
+ const ret = new Promise(cb0);
949
+ return addHeapObject(ret);
950
+ } finally {
951
+ state0.a = state0.b = 0;
952
+ }
953
+ };
954
+ imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function (arg0) {
955
+ const ret = Promise.resolve(getObject(arg0));
956
+ return addHeapObject(ret);
957
+ };
958
+ imports.wbg.__wbg_then_ce526c837d07b68f = function (arg0, arg1) {
959
+ const ret = getObject(arg0).then(getObject(arg1));
960
+ return addHeapObject(ret);
961
+ };
962
+ imports.wbg.__wbg_then_842e65b843962f56 = function (arg0, arg1, arg2) {
963
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
964
+ return addHeapObject(ret);
965
+ };
966
+ imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function () {
967
+ return handleError(function () {
968
+ const ret = self.self;
969
+ return addHeapObject(ret);
970
+ }, arguments);
971
+ };
972
+ imports.wbg.__wbg_window_9b61fbbf3564c4fb = function () {
973
+ return handleError(function () {
974
+ const ret = window.window;
975
+ return addHeapObject(ret);
976
+ }, arguments);
977
+ };
978
+ imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function () {
979
+ return handleError(function () {
980
+ const ret = globalThis.globalThis;
981
+ return addHeapObject(ret);
982
+ }, arguments);
983
+ };
984
+ imports.wbg.__wbg_global_5de1e0f82bddcd27 = function () {
985
+ return handleError(function () {
986
+ const ret = global.global;
987
+ return addHeapObject(ret);
988
+ }, arguments);
989
+ };
990
+ imports.wbg.__wbg_buffer_7af23f65f6c64548 = function (arg0) {
991
+ const ret = getObject(arg0).buffer;
992
+ return addHeapObject(ret);
993
+ };
994
+ imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function (arg0, arg1, arg2) {
995
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
996
+ return addHeapObject(ret);
997
+ };
998
+ imports.wbg.__wbg_new_cc9018bd6f283b6f = function (arg0) {
999
+ const ret = new Uint8Array(getObject(arg0));
1000
+ return addHeapObject(ret);
1001
+ };
1002
+ imports.wbg.__wbg_set_f25e869e4565d2a2 = function (arg0, arg1, arg2) {
1003
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1004
+ };
1005
+ imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function (arg0) {
1006
+ const ret = getObject(arg0).length;
1007
+ return ret;
1008
+ };
1009
+ imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function (arg0) {
1010
+ const ret = new Uint8Array(arg0 >>> 0);
1011
+ return addHeapObject(ret);
1012
+ };
1013
+ imports.wbg.__wbg_subarray_da527dbd24eafb6b = function (arg0, arg1, arg2) {
1014
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1015
+ return addHeapObject(ret);
1016
+ };
1017
+ imports.wbg.__wbg_has_ce995ec88636803d = function () {
1018
+ return handleError(function (arg0, arg1) {
1019
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
1020
+ return ret;
1021
+ }, arguments);
1022
+ };
1023
+ imports.wbg.__wbg_set_93b1c87ee2af852e = function () {
1024
+ return handleError(function (arg0, arg1, arg2) {
1025
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1026
+ return ret;
1027
+ }, arguments);
1028
+ };
1029
+ imports.wbg.__wbg_stringify_c760003feffcc1f2 = function () {
1030
+ return handleError(function (arg0) {
1031
+ const ret = JSON.stringify(getObject(arg0));
1032
+ return addHeapObject(ret);
1033
+ }, arguments);
1034
+ };
1035
+ imports.wbg.__wbindgen_debug_string = function (arg0, arg1) {
1036
+ const ret = debugString(getObject(arg1));
1037
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1038
+ const len0 = WASM_VECTOR_LEN;
1039
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
1040
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
1041
+ };
1042
+ imports.wbg.__wbindgen_throw = function (arg0, arg1) {
1043
+ throw new Error(getStringFromWasm0(arg0, arg1));
1044
+ };
1045
+ imports.wbg.__wbindgen_memory = function () {
1046
+ const ret = wasm.memory;
1047
+ return addHeapObject(ret);
1048
+ };
1049
+ imports.wbg.__wbindgen_closure_wrapper10902 = function (arg0, arg1, arg2) {
1050
+ const ret = makeMutClosure(arg0, arg1, 3717, __wbg_adapter_24);
1051
+ return addHeapObject(ret);
1052
+ };
1053
+
1054
+ if (
1055
+ typeof input === 'string' ||
1056
+ (typeof Request === 'function' && input instanceof Request) ||
1057
+ (typeof URL === 'function' && input instanceof URL)
1058
+ ) {
1059
+ input = fetch(input);
1060
+ }
1061
+
1062
+ const { instance, module } = await load(await input, imports);
1063
+
1064
+ wasm = instance.exports;
1065
+ init.__wbindgen_wasm_module = module;
1066
+
1067
+ return wasm;
1068
+ }
1069
+
1070
+ export default init;