@synonymdev/pubky 0.4.2-rc2 → 0.5.0-rc.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/README.md CHANGED
@@ -273,7 +273,7 @@ Clone the Pubky repository:
273
273
 
274
274
  ```bash
275
275
  git clone https://github.com/pubky/pubky
276
- cd pubky/pkg
276
+ cd pubky-client/pkg
277
277
  ```
278
278
 
279
279
  Run the local testnet server
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,42 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
285
263
  return Keypair.__wrap(ret[0]);
286
264
  };
287
265
 
288
- function __wbg_adapter_30(arg0, arg1, arg2) {
289
- wasm.closure486_externref_shim(arg0, arg1, arg2);
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
+ function __wbg_adapter_30(arg0, arg1) {
289
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h65148d1329d3fd27(arg0, arg1);
290
+ }
291
+
292
+ function __wbg_adapter_33(arg0, arg1) {
293
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc42965ff6d9cbff1(arg0, arg1);
290
294
  }
291
295
 
292
- function __wbg_adapter_160(arg0, arg1, arg2, arg3) {
293
- wasm.closure555_externref_shim(arg0, arg1, arg2, arg3);
296
+ function __wbg_adapter_36(arg0, arg1, arg2) {
297
+ wasm.closure511_externref_shim(arg0, arg1, arg2);
298
+ }
299
+
300
+ function __wbg_adapter_177(arg0, arg1, arg2, arg3) {
301
+ wasm.closure578_externref_shim(arg0, arg1, arg2, arg3);
294
302
  }
295
303
 
296
304
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -467,6 +475,18 @@ class Client {
467
475
  const ret = wasm.client_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
468
476
  return ret;
469
477
  }
478
+ /**
479
+ * Get the homeserver id for a given Pubky public key.
480
+ * Looks up the pkarr packet for the given public key and returns the content of the first `_pubky` SVCB record.
481
+ * Throws an error if no homeserver is found.
482
+ * @param {PublicKey} public_key
483
+ * @returns {Promise<PublicKey>}
484
+ */
485
+ getHomeserver(public_key) {
486
+ _assertClass(public_key, PublicKey);
487
+ const ret = wasm.client_getHomeserver(this.__wbg_ptr, public_key.__wbg_ptr);
488
+ return ret;
489
+ }
470
490
  /**
471
491
  * Republish the user's PKarr record pointing to their homeserver.
472
492
  *
@@ -722,6 +742,10 @@ class Session {
722
742
  }
723
743
  module.exports.Session = Session;
724
744
 
745
+ module.exports.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
746
+ arg0.abort(arg1);
747
+ };
748
+
725
749
  module.exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
726
750
  arg0.abort();
727
751
  };
@@ -755,6 +779,16 @@ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(fun
755
779
  return ret;
756
780
  }, arguments) };
757
781
 
782
+ module.exports.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) {
783
+ const ret = clearTimeout(arg0);
784
+ return ret;
785
+ };
786
+
787
+ module.exports.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
788
+ const ret = clearTimeout(arg0);
789
+ return ret;
790
+ };
791
+
758
792
  module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
759
793
  const ret = arg0.crypto;
760
794
  return ret;
@@ -773,17 +807,17 @@ module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
773
807
  console.error(arg0, arg1, arg2, arg3);
774
808
  };
775
809
 
776
- module.exports.__wbg_fetch_4465c2b10f21a927 = function(arg0) {
777
- const ret = fetch(arg0);
810
+ module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
811
+ const ret = arg0.fetch(arg1);
778
812
  return ret;
779
813
  };
780
814
 
781
- module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
782
- const ret = arg0.fetch(arg1);
815
+ module.exports.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
816
+ const ret = fetch(arg0);
783
817
  return ret;
784
818
  };
785
819
 
786
- module.exports.__wbg_fetch_d8b19b0ecd6b9e46 = function(arg0) {
820
+ module.exports.__wbg_fetch_e9ba2f53fcaeab31 = function(arg0) {
787
821
  const ret = fetch(arg0);
788
822
  return ret;
789
823
  };
@@ -873,7 +907,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
873
907
  const a = state0.a;
874
908
  state0.a = 0;
875
909
  try {
876
- return __wbg_adapter_160(a, state0.b, arg0, arg1);
910
+ return __wbg_adapter_177(a, state0.b, arg0, arg1);
877
911
  } finally {
878
912
  state0.a = a;
879
913
  }
@@ -988,6 +1022,16 @@ module.exports.__wbg_session_new = function(arg0) {
988
1022
  return ret;
989
1023
  };
990
1024
 
1025
+ module.exports.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
1026
+ const ret = setTimeout(arg0, arg1);
1027
+ return ret;
1028
+ };
1029
+
1030
+ module.exports.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
1031
+ const ret = setTimeout(arg0, arg1);
1032
+ return ret;
1033
+ }, arguments) };
1034
+
991
1035
  module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
992
1036
  arg0.set(arg1, arg2 >>> 0);
993
1037
  };
@@ -1103,8 +1147,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
1103
1147
  return ret;
1104
1148
  };
1105
1149
 
1106
- module.exports.__wbindgen_closure_wrapper2701 = function(arg0, arg1, arg2) {
1107
- const ret = makeMutClosure(arg0, arg1, 487, __wbg_adapter_30);
1150
+ module.exports.__wbindgen_closure_wrapper1238 = function(arg0, arg1, arg2) {
1151
+ const ret = makeMutClosure(arg0, arg1, 311, __wbg_adapter_30);
1152
+ return ret;
1153
+ };
1154
+
1155
+ module.exports.__wbindgen_closure_wrapper2549 = function(arg0, arg1, arg2) {
1156
+ const ret = makeMutClosure(arg0, arg1, 498, __wbg_adapter_33);
1157
+ return ret;
1158
+ };
1159
+
1160
+ module.exports.__wbindgen_closure_wrapper2811 = function(arg0, arg1, arg2) {
1161
+ const ret = makeMutClosure(arg0, arg1, 512, __wbg_adapter_36);
1108
1162
  return ret;
1109
1163
  };
1110
1164