@synonymdev/pubky 0.2.1 → 0.4.0-rc.4

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