@synonymdev/pubky 0.4.2-rc2 → 0.4.2

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
@@ -217,34 +217,6 @@ function _assertClass(instance, klass) {
217
217
  throw new Error(`expected instance of ${klass.name}`);
218
218
  }
219
219
  }
220
-
221
- function takeFromExternrefTable0(idx) {
222
- const value = wasm.__wbindgen_export_2.get(idx);
223
- wasm.__externref_table_dealloc(idx);
224
- return value;
225
- }
226
- /**
227
- * @param {string} level
228
- */
229
- module.exports.setLogLevel = function(level) {
230
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
- const len0 = WASM_VECTOR_LEN;
232
- const ret = wasm.setLogLevel(ptr0, len0);
233
- if (ret[1]) {
234
- throw takeFromExternrefTable0(ret[0]);
235
- }
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(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
244
- }
245
- wasm.__externref_drop_slice(ptr, len);
246
- return result;
247
- }
248
220
  /**
249
221
  * Create a recovery file of the `keypair`, containing the secret key encrypted
250
222
  * using the `passphrase`.
@@ -266,6 +238,12 @@ function passArray8ToWasm0(arg, malloc) {
266
238
  WASM_VECTOR_LEN = arg.length;
267
239
  return ptr;
268
240
  }
241
+
242
+ function takeFromExternrefTable0(idx) {
243
+ const value = wasm.__wbindgen_export_2.get(idx);
244
+ wasm.__externref_table_dealloc(idx);
245
+ return value;
246
+ }
269
247
  /**
270
248
  * Create a recovery file of the `keypair`, containing the secret key encrypted
271
249
  * using the `passphrase`.
@@ -285,12 +263,34 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
285
263
  return Keypair.__wrap(ret[0]);
286
264
  };
287
265
 
266
+ /**
267
+ * @param {string} level
268
+ */
269
+ module.exports.setLogLevel = function(level) {
270
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ const ret = wasm.setLogLevel(ptr0, len0);
273
+ if (ret[1]) {
274
+ throw takeFromExternrefTable0(ret[0]);
275
+ }
276
+ };
277
+
278
+ function getArrayJsValueFromWasm0(ptr, len) {
279
+ ptr = ptr >>> 0;
280
+ const mem = getDataViewMemory0();
281
+ const result = [];
282
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
283
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
284
+ }
285
+ wasm.__externref_drop_slice(ptr, len);
286
+ return result;
287
+ }
288
288
  function __wbg_adapter_30(arg0, arg1, arg2) {
289
- wasm.closure486_externref_shim(arg0, arg1, arg2);
289
+ wasm.closure495_externref_shim(arg0, arg1, arg2);
290
290
  }
291
291
 
292
- function __wbg_adapter_160(arg0, arg1, arg2, arg3) {
293
- wasm.closure555_externref_shim(arg0, arg1, arg2, arg3);
292
+ function __wbg_adapter_161(arg0, arg1, arg2, arg3) {
293
+ wasm.closure564_externref_shim(arg0, arg1, arg2, arg3);
294
294
  }
295
295
 
296
296
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -467,6 +467,18 @@ class Client {
467
467
  const ret = wasm.client_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
468
468
  return ret;
469
469
  }
470
+ /**
471
+ * Get the homeserver id for a given Pubky public key.
472
+ * Looks up the pkarr packet for the given public key and returns the content of the first `_pubky` SVCB record.
473
+ * Throws an error if no homeserver is found.
474
+ * @param {PublicKey} public_key
475
+ * @returns {Promise<PublicKey>}
476
+ */
477
+ getHomeserver(public_key) {
478
+ _assertClass(public_key, PublicKey);
479
+ const ret = wasm.client_getHomeserver(this.__wbg_ptr, public_key.__wbg_ptr);
480
+ return ret;
481
+ }
470
482
  /**
471
483
  * Republish the user's PKarr record pointing to their homeserver.
472
484
  *
@@ -783,7 +795,7 @@ module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
783
795
  return ret;
784
796
  };
785
797
 
786
- module.exports.__wbg_fetch_d8b19b0ecd6b9e46 = function(arg0) {
798
+ module.exports.__wbg_fetch_bb73d6305c7ef972 = function(arg0) {
787
799
  const ret = fetch(arg0);
788
800
  return ret;
789
801
  };
@@ -873,7 +885,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
873
885
  const a = state0.a;
874
886
  state0.a = 0;
875
887
  try {
876
- return __wbg_adapter_160(a, state0.b, arg0, arg1);
888
+ return __wbg_adapter_161(a, state0.b, arg0, arg1);
877
889
  } finally {
878
890
  state0.a = a;
879
891
  }
@@ -1103,8 +1115,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
1103
1115
  return ret;
1104
1116
  };
1105
1117
 
1106
- module.exports.__wbindgen_closure_wrapper2701 = function(arg0, arg1, arg2) {
1107
- const ret = makeMutClosure(arg0, arg1, 487, __wbg_adapter_30);
1118
+ module.exports.__wbindgen_closure_wrapper2737 = function(arg0, arg1, arg2) {
1119
+ const ret = makeMutClosure(arg0, arg1, 496, __wbg_adapter_30);
1108
1120
  return ret;
1109
1121
  };
1110
1122