@synonymdev/pubky 0.2.0 → 0.2.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/index.cjs CHANGED
@@ -3,4 +3,1149 @@ const makeFetchCookie = require("fetch-cookie").default;
3
3
  let originalFetch = globalThis.fetch;
4
4
  globalThis.fetch = makeFetchCookie(originalFetch);
5
5
 
6
- module.exports = require('./nodejs/pubky')
6
+
7
+ let imports = {};
8
+ imports['__wbindgen_placeholder__'] = module.exports;
9
+ let wasm;
10
+ const { TextDecoder, TextEncoder } = require(`util`);
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ let cachedUint8ArrayMemory0 = null;
17
+
18
+ function getUint8ArrayMemory0() {
19
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
20
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
21
+ }
22
+ return cachedUint8ArrayMemory0;
23
+ }
24
+
25
+ function getStringFromWasm0(ptr, len) {
26
+ ptr = ptr >>> 0;
27
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
28
+ }
29
+
30
+ const heap = new Array(128).fill(undefined);
31
+
32
+ heap.push(undefined, null, true, false);
33
+
34
+ let heap_next = heap.length;
35
+
36
+ function addHeapObject(obj) {
37
+ if (heap_next === heap.length) heap.push(heap.length + 1);
38
+ const idx = heap_next;
39
+ heap_next = heap[idx];
40
+
41
+ heap[idx] = obj;
42
+ return idx;
43
+ }
44
+
45
+ function getObject(idx) { return heap[idx]; }
46
+
47
+ function dropObject(idx) {
48
+ if (idx < 132) return;
49
+ heap[idx] = heap_next;
50
+ heap_next = idx;
51
+ }
52
+
53
+ function takeObject(idx) {
54
+ const ret = getObject(idx);
55
+ dropObject(idx);
56
+ return ret;
57
+ }
58
+
59
+ let WASM_VECTOR_LEN = 0;
60
+
61
+ let cachedTextEncoder = new TextEncoder('utf-8');
62
+
63
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
64
+ ? function (arg, view) {
65
+ return cachedTextEncoder.encodeInto(arg, view);
66
+ }
67
+ : function (arg, view) {
68
+ const buf = cachedTextEncoder.encode(arg);
69
+ view.set(buf);
70
+ return {
71
+ read: arg.length,
72
+ written: buf.length
73
+ };
74
+ });
75
+
76
+ function passStringToWasm0(arg, malloc, realloc) {
77
+
78
+ if (realloc === undefined) {
79
+ const buf = cachedTextEncoder.encode(arg);
80
+ const ptr = malloc(buf.length, 1) >>> 0;
81
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
82
+ WASM_VECTOR_LEN = buf.length;
83
+ return ptr;
84
+ }
85
+
86
+ let len = arg.length;
87
+ let ptr = malloc(len, 1) >>> 0;
88
+
89
+ const mem = getUint8ArrayMemory0();
90
+
91
+ let offset = 0;
92
+
93
+ for (; offset < len; offset++) {
94
+ const code = arg.charCodeAt(offset);
95
+ if (code > 0x7F) break;
96
+ mem[ptr + offset] = code;
97
+ }
98
+
99
+ if (offset !== len) {
100
+ if (offset !== 0) {
101
+ arg = arg.slice(offset);
102
+ }
103
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
104
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
105
+ const ret = encodeString(arg, view);
106
+
107
+ offset += ret.written;
108
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
109
+ }
110
+
111
+ WASM_VECTOR_LEN = offset;
112
+ return ptr;
113
+ }
114
+
115
+ function isLikeNone(x) {
116
+ return x === undefined || x === null;
117
+ }
118
+
119
+ let cachedDataViewMemory0 = null;
120
+
121
+ function getDataViewMemory0() {
122
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
123
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
124
+ }
125
+ return cachedDataViewMemory0;
126
+ }
127
+
128
+ function debugString(val) {
129
+ // primitive types
130
+ const type = typeof val;
131
+ if (type == 'number' || type == 'boolean' || val == null) {
132
+ return `${val}`;
133
+ }
134
+ if (type == 'string') {
135
+ return `"${val}"`;
136
+ }
137
+ if (type == 'symbol') {
138
+ const description = val.description;
139
+ if (description == null) {
140
+ return 'Symbol';
141
+ } else {
142
+ return `Symbol(${description})`;
143
+ }
144
+ }
145
+ if (type == 'function') {
146
+ const name = val.name;
147
+ if (typeof name == 'string' && name.length > 0) {
148
+ return `Function(${name})`;
149
+ } else {
150
+ return 'Function';
151
+ }
152
+ }
153
+ // objects
154
+ if (Array.isArray(val)) {
155
+ const length = val.length;
156
+ let debug = '[';
157
+ if (length > 0) {
158
+ debug += debugString(val[0]);
159
+ }
160
+ for(let i = 1; i < length; i++) {
161
+ debug += ', ' + debugString(val[i]);
162
+ }
163
+ debug += ']';
164
+ return debug;
165
+ }
166
+ // Test for built-in
167
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
168
+ let className;
169
+ if (builtInMatches.length > 1) {
170
+ className = builtInMatches[1];
171
+ } else {
172
+ // Failed to match the standard '[object ClassName]'
173
+ return toString.call(val);
174
+ }
175
+ if (className == 'Object') {
176
+ // we're a user defined class or Object
177
+ // JSON.stringify avoids problems with cycles, and is generally much
178
+ // easier than looping through ownProperties of `val`.
179
+ try {
180
+ return 'Object(' + JSON.stringify(val) + ')';
181
+ } catch (_) {
182
+ return 'Object';
183
+ }
184
+ }
185
+ // errors
186
+ if (val instanceof Error) {
187
+ return `${val.name}: ${val.message}\n${val.stack}`;
188
+ }
189
+ // TODO we could test for more things here, like `Set`s and `Map`s.
190
+ return className;
191
+ }
192
+
193
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
194
+ ? { register: () => {}, unregister: () => {} }
195
+ : new FinalizationRegistry(state => {
196
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
197
+ });
198
+
199
+ function makeMutClosure(arg0, arg1, dtor, f) {
200
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
201
+ const real = (...args) => {
202
+ // First up with a closure we increment the internal reference
203
+ // count. This ensures that the Rust closure environment won't
204
+ // be deallocated while we're invoking it.
205
+ state.cnt++;
206
+ const a = state.a;
207
+ state.a = 0;
208
+ try {
209
+ return f(a, state.b, ...args);
210
+ } finally {
211
+ if (--state.cnt === 0) {
212
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
213
+ CLOSURE_DTORS.unregister(state);
214
+ } else {
215
+ state.a = a;
216
+ }
217
+ }
218
+ };
219
+ real.original = state;
220
+ CLOSURE_DTORS.register(real, state, state);
221
+ return real;
222
+ }
223
+ function __wbg_adapter_26(arg0, arg1, arg2) {
224
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf3abd8d2e3570b7c(arg0, arg1, addHeapObject(arg2));
225
+ }
226
+
227
+ function _assertClass(instance, klass) {
228
+ if (!(instance instanceof klass)) {
229
+ throw new Error(`expected instance of ${klass.name}`);
230
+ }
231
+ return instance.ptr;
232
+ }
233
+ /**
234
+ * Create a recovery file of the `keypair`, containing the secret key encrypted
235
+ * using the `passphrase`.
236
+ * @param {Keypair} keypair
237
+ * @param {string} passphrase
238
+ * @returns {Uint8Array}
239
+ */
240
+ module.exports.createRecoveryFile = function(keypair, passphrase) {
241
+ try {
242
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
243
+ _assertClass(keypair, Keypair);
244
+ const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ wasm.createRecoveryFile(retptr, keypair.__wbg_ptr, ptr0, len0);
247
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
248
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
249
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
250
+ if (r2) {
251
+ throw takeObject(r1);
252
+ }
253
+ return takeObject(r0);
254
+ } finally {
255
+ wasm.__wbindgen_add_to_stack_pointer(16);
256
+ }
257
+ };
258
+
259
+ function passArray8ToWasm0(arg, malloc) {
260
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
261
+ getUint8ArrayMemory0().set(arg, ptr / 1);
262
+ WASM_VECTOR_LEN = arg.length;
263
+ return ptr;
264
+ }
265
+ /**
266
+ * Create a recovery file of the `keypair`, containing the secret key encrypted
267
+ * using the `passphrase`.
268
+ * @param {Uint8Array} recovery_file
269
+ * @param {string} passphrase
270
+ * @returns {Keypair}
271
+ */
272
+ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
273
+ try {
274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
275
+ const ptr0 = passArray8ToWasm0(recovery_file, wasm.__wbindgen_malloc);
276
+ const len0 = WASM_VECTOR_LEN;
277
+ const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len1 = WASM_VECTOR_LEN;
279
+ wasm.decryptRecoveryFile(retptr, ptr0, len0, ptr1, len1);
280
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
281
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
282
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
283
+ if (r2) {
284
+ throw takeObject(r1);
285
+ }
286
+ return Keypair.__wrap(r0);
287
+ } finally {
288
+ wasm.__wbindgen_add_to_stack_pointer(16);
289
+ }
290
+ };
291
+
292
+ function getArrayJsValueFromWasm0(ptr, len) {
293
+ ptr = ptr >>> 0;
294
+ const mem = getDataViewMemory0();
295
+ const result = [];
296
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
297
+ result.push(takeObject(mem.getUint32(i, true)));
298
+ }
299
+ return result;
300
+ }
301
+
302
+ function handleError(f, args) {
303
+ try {
304
+ return f.apply(this, args);
305
+ } catch (e) {
306
+ wasm.__wbindgen_exn_store(addHeapObject(e));
307
+ }
308
+ }
309
+ function __wbg_adapter_141(arg0, arg1, arg2, arg3) {
310
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h6757e2d3bad4487e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
311
+ }
312
+
313
+ const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
314
+ ? { register: () => {}, unregister: () => {} }
315
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
316
+ /**
317
+ */
318
+ class Keypair {
319
+
320
+ static __wrap(ptr) {
321
+ ptr = ptr >>> 0;
322
+ const obj = Object.create(Keypair.prototype);
323
+ obj.__wbg_ptr = ptr;
324
+ KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
325
+ return obj;
326
+ }
327
+
328
+ __destroy_into_raw() {
329
+ const ptr = this.__wbg_ptr;
330
+ this.__wbg_ptr = 0;
331
+ KeypairFinalization.unregister(this);
332
+ return ptr;
333
+ }
334
+
335
+ free() {
336
+ const ptr = this.__destroy_into_raw();
337
+ wasm.__wbg_keypair_free(ptr, 0);
338
+ }
339
+ /**
340
+ * Generate a random [Keypair]
341
+ * @returns {Keypair}
342
+ */
343
+ static random() {
344
+ const ret = wasm.keypair_random();
345
+ return Keypair.__wrap(ret);
346
+ }
347
+ /**
348
+ * Generate a [Keypair] from a secret key.
349
+ * @param {Uint8Array} secret_key
350
+ * @returns {Keypair}
351
+ */
352
+ static fromSecretKey(secret_key) {
353
+ try {
354
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
355
+ wasm.keypair_fromSecretKey(retptr, addHeapObject(secret_key));
356
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
357
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
358
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
359
+ if (r2) {
360
+ throw takeObject(r1);
361
+ }
362
+ return Keypair.__wrap(r0);
363
+ } finally {
364
+ wasm.__wbindgen_add_to_stack_pointer(16);
365
+ }
366
+ }
367
+ /**
368
+ * Returns the secret key of this keypair.
369
+ * @returns {Uint8Array}
370
+ */
371
+ secretKey() {
372
+ const ret = wasm.keypair_secretKey(this.__wbg_ptr);
373
+ return takeObject(ret);
374
+ }
375
+ /**
376
+ * Returns the [PublicKey] of this keypair.
377
+ * @returns {PublicKey}
378
+ */
379
+ publicKey() {
380
+ const ret = wasm.keypair_publicKey(this.__wbg_ptr);
381
+ return PublicKey.__wrap(ret);
382
+ }
383
+ }
384
+ module.exports.Keypair = Keypair;
385
+
386
+ const PubkyClientFinalization = (typeof FinalizationRegistry === 'undefined')
387
+ ? { register: () => {}, unregister: () => {} }
388
+ : new FinalizationRegistry(ptr => wasm.__wbg_pubkyclient_free(ptr >>> 0, 1));
389
+ /**
390
+ */
391
+ class PubkyClient {
392
+
393
+ static __wrap(ptr) {
394
+ ptr = ptr >>> 0;
395
+ const obj = Object.create(PubkyClient.prototype);
396
+ obj.__wbg_ptr = ptr;
397
+ PubkyClientFinalization.register(obj, obj.__wbg_ptr, obj);
398
+ return obj;
399
+ }
400
+
401
+ __destroy_into_raw() {
402
+ const ptr = this.__wbg_ptr;
403
+ this.__wbg_ptr = 0;
404
+ PubkyClientFinalization.unregister(this);
405
+ return ptr;
406
+ }
407
+
408
+ free() {
409
+ const ptr = this.__destroy_into_raw();
410
+ wasm.__wbg_pubkyclient_free(ptr, 0);
411
+ }
412
+ /**
413
+ * Signup to a homeserver and update Pkarr accordingly.
414
+ *
415
+ * The homeserver is a Pkarr domain name, where the TLD is a Pkarr public key
416
+ * for example "pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy"
417
+ * @param {Keypair} keypair
418
+ * @param {PublicKey} homeserver
419
+ * @returns {Promise<Session>}
420
+ */
421
+ signup(keypair, homeserver) {
422
+ _assertClass(keypair, Keypair);
423
+ _assertClass(homeserver, PublicKey);
424
+ const ret = wasm.pubkyclient_signup(this.__wbg_ptr, keypair.__wbg_ptr, homeserver.__wbg_ptr);
425
+ return takeObject(ret);
426
+ }
427
+ /**
428
+ * Check the current sesison for a given Pubky in its homeserver.
429
+ *
430
+ * Returns [Session] or `None` (if recieved `404 NOT_FOUND`),
431
+ * or throws the recieved error if the response has any other `>=400` status code.
432
+ * @param {PublicKey} pubky
433
+ * @returns {Promise<Session | undefined>}
434
+ */
435
+ session(pubky) {
436
+ _assertClass(pubky, PublicKey);
437
+ const ret = wasm.pubkyclient_session(this.__wbg_ptr, pubky.__wbg_ptr);
438
+ return takeObject(ret);
439
+ }
440
+ /**
441
+ * Signout from a homeserver.
442
+ * @param {PublicKey} pubky
443
+ * @returns {Promise<void>}
444
+ */
445
+ signout(pubky) {
446
+ _assertClass(pubky, PublicKey);
447
+ const ret = wasm.pubkyclient_signout(this.__wbg_ptr, pubky.__wbg_ptr);
448
+ return takeObject(ret);
449
+ }
450
+ /**
451
+ * Signin to a homeserver using the root Keypair.
452
+ * @param {Keypair} keypair
453
+ * @returns {Promise<void>}
454
+ */
455
+ signin(keypair) {
456
+ _assertClass(keypair, Keypair);
457
+ const ret = wasm.pubkyclient_signin(this.__wbg_ptr, keypair.__wbg_ptr);
458
+ return takeObject(ret);
459
+ }
460
+ /**
461
+ * Return `pubkyauth://` url and wait for the incoming [AuthToken]
462
+ * verifying that AuthToken, and if capabilities were requested, signing in to
463
+ * the Pubky's homeserver and returning the [Session] information.
464
+ *
465
+ * Returns a tuple of [pubkyAuthUrl, Promise<Session>]
466
+ * @param {string} relay
467
+ * @param {string} capabilities
468
+ * @returns {Array<any>}
469
+ */
470
+ authRequest(relay, capabilities) {
471
+ try {
472
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
473
+ const ptr0 = passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
474
+ const len0 = WASM_VECTOR_LEN;
475
+ const ptr1 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len1 = WASM_VECTOR_LEN;
477
+ wasm.pubkyclient_authRequest(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
478
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
479
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
480
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
481
+ if (r2) {
482
+ throw takeObject(r1);
483
+ }
484
+ return takeObject(r0);
485
+ } finally {
486
+ wasm.__wbindgen_add_to_stack_pointer(16);
487
+ }
488
+ }
489
+ /**
490
+ * Sign an [pubky_common::auth::AuthToken], encrypt it and send it to the
491
+ * source of the pubkyauth request url.
492
+ * @param {Keypair} keypair
493
+ * @param {string} pubkyauth_url
494
+ * @returns {Promise<void>}
495
+ */
496
+ sendAuthToken(keypair, pubkyauth_url) {
497
+ _assertClass(keypair, Keypair);
498
+ const ptr0 = passStringToWasm0(pubkyauth_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
499
+ const len0 = WASM_VECTOR_LEN;
500
+ const ret = wasm.pubkyclient_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
501
+ return takeObject(ret);
502
+ }
503
+ /**
504
+ * Upload a small payload to a given path.
505
+ * @param {string} url
506
+ * @param {Uint8Array} content
507
+ * @returns {Promise<void>}
508
+ */
509
+ put(url, content) {
510
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
511
+ const len0 = WASM_VECTOR_LEN;
512
+ const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
513
+ const len1 = WASM_VECTOR_LEN;
514
+ const ret = wasm.pubkyclient_put(this.__wbg_ptr, ptr0, len0, ptr1, len1);
515
+ return takeObject(ret);
516
+ }
517
+ /**
518
+ * Download a small payload from a given path relative to a pubky author.
519
+ * @param {string} url
520
+ * @returns {Promise<Uint8Array | undefined>}
521
+ */
522
+ get(url) {
523
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.pubkyclient_get(this.__wbg_ptr, ptr0, len0);
526
+ return takeObject(ret);
527
+ }
528
+ /**
529
+ * Delete a file at a path relative to a pubky author.
530
+ * @param {string} url
531
+ * @returns {Promise<void>}
532
+ */
533
+ delete(url) {
534
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
535
+ const len0 = WASM_VECTOR_LEN;
536
+ const ret = wasm.pubkyclient_delete(this.__wbg_ptr, ptr0, len0);
537
+ return takeObject(ret);
538
+ }
539
+ /**
540
+ * Returns a list of Pubky urls (as strings).
541
+ *
542
+ * - `url`: The Pubky url (string) to the directory you want to list its content.
543
+ * - `cursor`: Either a full `pubky://` Url (from previous list response),
544
+ * or a path (to a file or directory) relative to the `url`
545
+ * - `reverse`: List in reverse order
546
+ * - `limit` Limit the number of urls in the response
547
+ * - `shallow`: List directories and files, instead of flat list of files.
548
+ * @param {string} url
549
+ * @param {string | undefined} [cursor]
550
+ * @param {boolean | undefined} [reverse]
551
+ * @param {number | undefined} [limit]
552
+ * @param {boolean | undefined} [shallow]
553
+ * @returns {Promise<Array<any>>}
554
+ */
555
+ list(url, cursor, reverse, limit, shallow) {
556
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
+ const len0 = WASM_VECTOR_LEN;
558
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
559
+ var len1 = WASM_VECTOR_LEN;
560
+ const ret = wasm.pubkyclient_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
561
+ return takeObject(ret);
562
+ }
563
+ /**
564
+ * Create PubkyClient with default Settings including default relays
565
+ */
566
+ constructor() {
567
+ const ret = wasm.pubkyclient_new();
568
+ this.__wbg_ptr = ret >>> 0;
569
+ PubkyClientFinalization.register(this, this.__wbg_ptr, this);
570
+ return this;
571
+ }
572
+ /**
573
+ * Create a client with with configurations appropriate for local testing:
574
+ * - set Pkarr relays to `["http://localhost:15411/pkarr"]` instead of default relay.
575
+ * @returns {PubkyClient}
576
+ */
577
+ static testnet() {
578
+ const ret = wasm.pubkyclient_testnet();
579
+ return PubkyClient.__wrap(ret);
580
+ }
581
+ /**
582
+ * @param {string} url
583
+ * @param {any} init
584
+ * @returns {Promise<Promise<any>>}
585
+ */
586
+ fetch(url, init) {
587
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
588
+ const len0 = WASM_VECTOR_LEN;
589
+ const ret = wasm.pubkyclient_fetch(this.__wbg_ptr, ptr0, len0, addHeapObject(init));
590
+ return takeObject(ret);
591
+ }
592
+ }
593
+ module.exports.PubkyClient = PubkyClient;
594
+
595
+ const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
596
+ ? { register: () => {}, unregister: () => {} }
597
+ : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0, 1));
598
+ /**
599
+ */
600
+ class PublicKey {
601
+
602
+ static __wrap(ptr) {
603
+ ptr = ptr >>> 0;
604
+ const obj = Object.create(PublicKey.prototype);
605
+ obj.__wbg_ptr = ptr;
606
+ PublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);
607
+ return obj;
608
+ }
609
+
610
+ __destroy_into_raw() {
611
+ const ptr = this.__wbg_ptr;
612
+ this.__wbg_ptr = 0;
613
+ PublicKeyFinalization.unregister(this);
614
+ return ptr;
615
+ }
616
+
617
+ free() {
618
+ const ptr = this.__destroy_into_raw();
619
+ wasm.__wbg_publickey_free(ptr, 0);
620
+ }
621
+ /**
622
+ * Convert the PublicKey to Uint8Array
623
+ * @returns {Uint8Array}
624
+ */
625
+ to_uint8array() {
626
+ const ret = wasm.publickey_to_uint8array(this.__wbg_ptr);
627
+ return takeObject(ret);
628
+ }
629
+ /**
630
+ * Returns the z-base32 encoding of this public key
631
+ * @returns {string}
632
+ */
633
+ z32() {
634
+ let deferred1_0;
635
+ let deferred1_1;
636
+ try {
637
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
638
+ wasm.publickey_z32(retptr, this.__wbg_ptr);
639
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
640
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
641
+ deferred1_0 = r0;
642
+ deferred1_1 = r1;
643
+ return getStringFromWasm0(r0, r1);
644
+ } finally {
645
+ wasm.__wbindgen_add_to_stack_pointer(16);
646
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
647
+ }
648
+ }
649
+ /**
650
+ * @throws
651
+ * @param {any} value
652
+ * @returns {PublicKey}
653
+ */
654
+ static from(value) {
655
+ try {
656
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
657
+ wasm.publickey_from(retptr, addHeapObject(value));
658
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
659
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
660
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
661
+ if (r2) {
662
+ throw takeObject(r1);
663
+ }
664
+ return PublicKey.__wrap(r0);
665
+ } finally {
666
+ wasm.__wbindgen_add_to_stack_pointer(16);
667
+ }
668
+ }
669
+ }
670
+ module.exports.PublicKey = PublicKey;
671
+
672
+ const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
673
+ ? { register: () => {}, unregister: () => {} }
674
+ : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
675
+ /**
676
+ */
677
+ class Session {
678
+
679
+ static __wrap(ptr) {
680
+ ptr = ptr >>> 0;
681
+ const obj = Object.create(Session.prototype);
682
+ obj.__wbg_ptr = ptr;
683
+ SessionFinalization.register(obj, obj.__wbg_ptr, obj);
684
+ return obj;
685
+ }
686
+
687
+ __destroy_into_raw() {
688
+ const ptr = this.__wbg_ptr;
689
+ this.__wbg_ptr = 0;
690
+ SessionFinalization.unregister(this);
691
+ return ptr;
692
+ }
693
+
694
+ free() {
695
+ const ptr = this.__destroy_into_raw();
696
+ wasm.__wbg_session_free(ptr, 0);
697
+ }
698
+ /**
699
+ * Return the [PublicKey] of this session
700
+ * @returns {PublicKey}
701
+ */
702
+ pubky() {
703
+ const ret = wasm.session_pubky(this.__wbg_ptr);
704
+ return PublicKey.__wrap(ret);
705
+ }
706
+ /**
707
+ * Return the capabilities that this session has.
708
+ * @returns {(string)[]}
709
+ */
710
+ capabilities() {
711
+ try {
712
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
713
+ wasm.session_capabilities(retptr, this.__wbg_ptr);
714
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
715
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
716
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
717
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
718
+ return v1;
719
+ } finally {
720
+ wasm.__wbindgen_add_to_stack_pointer(16);
721
+ }
722
+ }
723
+ }
724
+ module.exports.Session = Session;
725
+
726
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
727
+ const ret = getStringFromWasm0(arg0, arg1);
728
+ return addHeapObject(ret);
729
+ };
730
+
731
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
732
+ takeObject(arg0);
733
+ };
734
+
735
+ module.exports.__wbg_publickey_new = function(arg0) {
736
+ const ret = PublicKey.__wrap(arg0);
737
+ return addHeapObject(ret);
738
+ };
739
+
740
+ module.exports.__wbg_session_new = function(arg0) {
741
+ const ret = Session.__wrap(arg0);
742
+ return addHeapObject(ret);
743
+ };
744
+
745
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
746
+ const obj = getObject(arg1);
747
+ const ret = typeof(obj) === 'string' ? obj : undefined;
748
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
+ var len1 = WASM_VECTOR_LEN;
750
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
751
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
752
+ };
753
+
754
+ module.exports.__wbg_fetch_f7009dcc8692ba82 = function(arg0) {
755
+ const ret = fetch(getObject(arg0));
756
+ return addHeapObject(ret);
757
+ };
758
+
759
+ module.exports.__wbg_fetch_f8d735ba6fe1b719 = function(arg0) {
760
+ const ret = fetch(getObject(arg0));
761
+ return addHeapObject(ret);
762
+ };
763
+
764
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
765
+ const ret = getObject(arg0);
766
+ return addHeapObject(ret);
767
+ };
768
+
769
+ module.exports.__wbindgen_cb_drop = function(arg0) {
770
+ const obj = takeObject(arg0).original;
771
+ if (obj.cnt-- == 1) {
772
+ obj.a = 0;
773
+ return true;
774
+ }
775
+ const ret = false;
776
+ return ret;
777
+ };
778
+
779
+ module.exports.__wbg_queueMicrotask_12a30234db4045d3 = function(arg0) {
780
+ queueMicrotask(getObject(arg0));
781
+ };
782
+
783
+ module.exports.__wbg_queueMicrotask_48421b3cc9052b68 = function(arg0) {
784
+ const ret = getObject(arg0).queueMicrotask;
785
+ return addHeapObject(ret);
786
+ };
787
+
788
+ module.exports.__wbindgen_is_function = function(arg0) {
789
+ const ret = typeof(getObject(arg0)) === 'function';
790
+ return ret;
791
+ };
792
+
793
+ module.exports.__wbg_fetch_ba7fe179e527d942 = function(arg0, arg1) {
794
+ const ret = getObject(arg0).fetch(getObject(arg1));
795
+ return addHeapObject(ret);
796
+ };
797
+
798
+ module.exports.__wbg_newwithstrandinit_a31c69e4cc337183 = function() { return handleError(function (arg0, arg1, arg2) {
799
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
800
+ return addHeapObject(ret);
801
+ }, arguments) };
802
+
803
+ module.exports.__wbg_setbody_734cb3d7ee8e6e96 = function(arg0, arg1) {
804
+ getObject(arg0).body = getObject(arg1);
805
+ };
806
+
807
+ module.exports.__wbg_setcredentials_2b67800db3f7b621 = function(arg0, arg1) {
808
+ getObject(arg0).credentials = ["omit","same-origin","include",][arg1];
809
+ };
810
+
811
+ module.exports.__wbg_setheaders_be10a5ab566fd06f = function(arg0, arg1) {
812
+ getObject(arg0).headers = getObject(arg1);
813
+ };
814
+
815
+ module.exports.__wbg_setmethod_dc68a742c2db5c6a = function(arg0, arg1, arg2) {
816
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
817
+ };
818
+
819
+ module.exports.__wbg_setmode_a781aae2bd3df202 = function(arg0, arg1) {
820
+ getObject(arg0).mode = ["same-origin","no-cors","cors","navigate",][arg1];
821
+ };
822
+
823
+ module.exports.__wbg_setsignal_91c4e8ebd04eb935 = function(arg0, arg1) {
824
+ getObject(arg0).signal = getObject(arg1);
825
+ };
826
+
827
+ module.exports.__wbg_signal_41e46ccad44bb5e2 = function(arg0) {
828
+ const ret = getObject(arg0).signal;
829
+ return addHeapObject(ret);
830
+ };
831
+
832
+ module.exports.__wbg_new_ebf2727385ee825c = function() { return handleError(function () {
833
+ const ret = new AbortController();
834
+ return addHeapObject(ret);
835
+ }, arguments) };
836
+
837
+ module.exports.__wbg_abort_8659d889a7877ae3 = function(arg0) {
838
+ getObject(arg0).abort();
839
+ };
840
+
841
+ module.exports.__wbg_new_e27c93803e1acc42 = function() { return handleError(function () {
842
+ const ret = new Headers();
843
+ return addHeapObject(ret);
844
+ }, arguments) };
845
+
846
+ module.exports.__wbg_append_f3a4426bb50622c5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
847
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
848
+ }, arguments) };
849
+
850
+ module.exports.__wbg_instanceof_Response_e91b7eb7c611a9ae = function(arg0) {
851
+ let result;
852
+ try {
853
+ result = getObject(arg0) instanceof Response;
854
+ } catch (_) {
855
+ result = false;
856
+ }
857
+ const ret = result;
858
+ return ret;
859
+ };
860
+
861
+ module.exports.__wbg_url_1bf85c8abeb8c92d = function(arg0, arg1) {
862
+ const ret = getObject(arg1).url;
863
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
864
+ const len1 = WASM_VECTOR_LEN;
865
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
866
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
867
+ };
868
+
869
+ module.exports.__wbg_status_ae8de515694c5c7c = function(arg0) {
870
+ const ret = getObject(arg0).status;
871
+ return ret;
872
+ };
873
+
874
+ module.exports.__wbg_headers_5e283e8345689121 = function(arg0) {
875
+ const ret = getObject(arg0).headers;
876
+ return addHeapObject(ret);
877
+ };
878
+
879
+ module.exports.__wbg_arrayBuffer_a5fbad63cc7e663b = function() { return handleError(function (arg0) {
880
+ const ret = getObject(arg0).arrayBuffer();
881
+ return addHeapObject(ret);
882
+ }, arguments) };
883
+
884
+ module.exports.__wbindgen_is_object = function(arg0) {
885
+ const val = getObject(arg0);
886
+ const ret = typeof(val) === 'object' && val !== null;
887
+ return ret;
888
+ };
889
+
890
+ module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
891
+ const ret = getObject(arg0).crypto;
892
+ return addHeapObject(ret);
893
+ };
894
+
895
+ module.exports.__wbg_process_4a72847cc503995b = function(arg0) {
896
+ const ret = getObject(arg0).process;
897
+ return addHeapObject(ret);
898
+ };
899
+
900
+ module.exports.__wbg_versions_f686565e586dd935 = function(arg0) {
901
+ const ret = getObject(arg0).versions;
902
+ return addHeapObject(ret);
903
+ };
904
+
905
+ module.exports.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
906
+ const ret = getObject(arg0).node;
907
+ return addHeapObject(ret);
908
+ };
909
+
910
+ module.exports.__wbindgen_is_string = function(arg0) {
911
+ const ret = typeof(getObject(arg0)) === 'string';
912
+ return ret;
913
+ };
914
+
915
+ module.exports.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
916
+ const ret = module.require;
917
+ return addHeapObject(ret);
918
+ }, arguments) };
919
+
920
+ module.exports.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
921
+ const ret = getObject(arg0).msCrypto;
922
+ return addHeapObject(ret);
923
+ };
924
+
925
+ module.exports.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
926
+ getObject(arg0).randomFillSync(takeObject(arg1));
927
+ }, arguments) };
928
+
929
+ module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
930
+ getObject(arg0).getRandomValues(getObject(arg1));
931
+ }, arguments) };
932
+
933
+ module.exports.__wbg_new_a220cf903aa02ca2 = function() {
934
+ const ret = new Array();
935
+ return addHeapObject(ret);
936
+ };
937
+
938
+ module.exports.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) {
939
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
940
+ return addHeapObject(ret);
941
+ };
942
+
943
+ module.exports.__wbg_next_de3e9db4440638b2 = function(arg0) {
944
+ const ret = getObject(arg0).next;
945
+ return addHeapObject(ret);
946
+ };
947
+
948
+ module.exports.__wbg_value_6d39332ab4788d86 = function(arg0) {
949
+ const ret = getObject(arg0).value;
950
+ return addHeapObject(ret);
951
+ };
952
+
953
+ module.exports.__wbg_iterator_888179a48810a9fe = function() {
954
+ const ret = Symbol.iterator;
955
+ return addHeapObject(ret);
956
+ };
957
+
958
+ module.exports.__wbg_new_525245e2b9901204 = function() {
959
+ const ret = new Object();
960
+ return addHeapObject(ret);
961
+ };
962
+
963
+ module.exports.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () {
964
+ const ret = self.self;
965
+ return addHeapObject(ret);
966
+ }, arguments) };
967
+
968
+ module.exports.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () {
969
+ const ret = window.window;
970
+ return addHeapObject(ret);
971
+ }, arguments) };
972
+
973
+ module.exports.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () {
974
+ const ret = globalThis.globalThis;
975
+ return addHeapObject(ret);
976
+ }, arguments) };
977
+
978
+ module.exports.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () {
979
+ const ret = global.global;
980
+ return addHeapObject(ret);
981
+ }, arguments) };
982
+
983
+ module.exports.__wbindgen_is_undefined = function(arg0) {
984
+ const ret = getObject(arg0) === undefined;
985
+ return ret;
986
+ };
987
+
988
+ module.exports.__wbg_push_37c89022f34c01ca = function(arg0, arg1) {
989
+ const ret = getObject(arg0).push(getObject(arg1));
990
+ return ret;
991
+ };
992
+
993
+ module.exports.__wbg_new_796382978dfd4fb0 = function(arg0, arg1) {
994
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
995
+ return addHeapObject(ret);
996
+ };
997
+
998
+ module.exports.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
999
+ const ret = getObject(arg0).call(getObject(arg1));
1000
+ return addHeapObject(ret);
1001
+ }, arguments) };
1002
+
1003
+ module.exports.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) {
1004
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1005
+ return addHeapObject(ret);
1006
+ }, arguments) };
1007
+
1008
+ module.exports.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
1009
+ const ret = getObject(arg0).next();
1010
+ return addHeapObject(ret);
1011
+ }, arguments) };
1012
+
1013
+ module.exports.__wbg_done_bfda7aa8f252b39f = function(arg0) {
1014
+ const ret = getObject(arg0).done;
1015
+ return ret;
1016
+ };
1017
+
1018
+ module.exports.__wbg_now_b7a162010a9e75b4 = function() {
1019
+ const ret = Date.now();
1020
+ return ret;
1021
+ };
1022
+
1023
+ module.exports.__wbg_new_b85e72ed1bfd57f9 = function(arg0, arg1) {
1024
+ try {
1025
+ var state0 = {a: arg0, b: arg1};
1026
+ var cb0 = (arg0, arg1) => {
1027
+ const a = state0.a;
1028
+ state0.a = 0;
1029
+ try {
1030
+ return __wbg_adapter_141(a, state0.b, arg0, arg1);
1031
+ } finally {
1032
+ state0.a = a;
1033
+ }
1034
+ };
1035
+ const ret = new Promise(cb0);
1036
+ return addHeapObject(ret);
1037
+ } finally {
1038
+ state0.a = state0.b = 0;
1039
+ }
1040
+ };
1041
+
1042
+ module.exports.__wbg_resolve_570458cb99d56a43 = function(arg0) {
1043
+ const ret = Promise.resolve(getObject(arg0));
1044
+ return addHeapObject(ret);
1045
+ };
1046
+
1047
+ module.exports.__wbg_then_95e6edc0f89b73b1 = function(arg0, arg1) {
1048
+ const ret = getObject(arg0).then(getObject(arg1));
1049
+ return addHeapObject(ret);
1050
+ };
1051
+
1052
+ module.exports.__wbg_then_876bb3c633745cc6 = function(arg0, arg1, arg2) {
1053
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1054
+ return addHeapObject(ret);
1055
+ };
1056
+
1057
+ module.exports.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
1058
+ const ret = getObject(arg0).buffer;
1059
+ return addHeapObject(ret);
1060
+ };
1061
+
1062
+ module.exports.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) {
1063
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1064
+ return addHeapObject(ret);
1065
+ };
1066
+
1067
+ module.exports.__wbg_new_ea1883e1e5e86686 = function(arg0) {
1068
+ const ret = new Uint8Array(getObject(arg0));
1069
+ return addHeapObject(ret);
1070
+ };
1071
+
1072
+ module.exports.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
1073
+ let result;
1074
+ try {
1075
+ result = getObject(arg0) instanceof Uint8Array;
1076
+ } catch (_) {
1077
+ result = false;
1078
+ }
1079
+ const ret = result;
1080
+ return ret;
1081
+ };
1082
+
1083
+ module.exports.__wbg_newwithlength_ec548f448387c968 = function(arg0) {
1084
+ const ret = new Uint8Array(arg0 >>> 0);
1085
+ return addHeapObject(ret);
1086
+ };
1087
+
1088
+ module.exports.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) {
1089
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1090
+ return addHeapObject(ret);
1091
+ };
1092
+
1093
+ module.exports.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
1094
+ const ret = getObject(arg0).length;
1095
+ return ret;
1096
+ };
1097
+
1098
+ module.exports.__wbg_byteLength_850664ef28f3e42f = function(arg0) {
1099
+ const ret = getObject(arg0).byteLength;
1100
+ return ret;
1101
+ };
1102
+
1103
+ module.exports.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
1104
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1105
+ };
1106
+
1107
+ module.exports.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
1108
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1109
+ return addHeapObject(ret);
1110
+ }, arguments) };
1111
+
1112
+ module.exports.__wbg_has_4bfbc01db38743f7 = function() { return handleError(function (arg0, arg1) {
1113
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
1114
+ return ret;
1115
+ }, arguments) };
1116
+
1117
+ module.exports.__wbg_stringify_bbf45426c92a6bf5 = function() { return handleError(function (arg0) {
1118
+ const ret = JSON.stringify(getObject(arg0));
1119
+ return addHeapObject(ret);
1120
+ }, arguments) };
1121
+
1122
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1123
+ const ret = debugString(getObject(arg1));
1124
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1125
+ const len1 = WASM_VECTOR_LEN;
1126
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1127
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1128
+ };
1129
+
1130
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
1131
+ throw new Error(getStringFromWasm0(arg0, arg1));
1132
+ };
1133
+
1134
+ module.exports.__wbindgen_memory = function() {
1135
+ const ret = wasm.memory;
1136
+ return addHeapObject(ret);
1137
+ };
1138
+
1139
+ module.exports.__wbindgen_closure_wrapper1476 = function(arg0, arg1, arg2) {
1140
+ const ret = makeMutClosure(arg0, arg1, 284, __wbg_adapter_26);
1141
+ return addHeapObject(ret);
1142
+ };
1143
+
1144
+ const path = require('path').join(__dirname, 'pubky_bg.wasm');
1145
+ const bytes = require('fs').readFileSync(path);
1146
+
1147
+ const wasmModule = new WebAssembly.Module(bytes);
1148
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
1149
+ wasm = wasmInstance.exports;
1150
+ module.exports.__wasm = wasm;
1151
+