@synonymdev/pubky 0.4.2-rc1 → 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 +54 -43
- package/index.js +58 -47
- package/package.json +2 -1
- package/pubky.d.ts +8 -2
- package/pubky_bg.wasm +0 -0
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.
|
|
289
|
+
wasm.closure495_externref_shim(arg0, arg1, arg2);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
function
|
|
293
|
-
wasm.
|
|
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
|
*
|
|
@@ -481,14 +493,13 @@ class Client {
|
|
|
481
493
|
* republishing. On a failed signin due to homeserver resolution failure, a key
|
|
482
494
|
* manager should always attempt to republish the last known homeserver.
|
|
483
495
|
* @param {Keypair} keypair
|
|
484
|
-
* @param {
|
|
496
|
+
* @param {PublicKey} host
|
|
485
497
|
* @returns {Promise<void>}
|
|
486
498
|
*/
|
|
487
499
|
republishHomeserver(keypair, host) {
|
|
488
500
|
_assertClass(keypair, Keypair);
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
const ret = wasm.client_republishHomeserver(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
|
|
501
|
+
_assertClass(host, PublicKey);
|
|
502
|
+
const ret = wasm.client_republishHomeserver(this.__wbg_ptr, keypair.__wbg_ptr, host.__wbg_ptr);
|
|
492
503
|
return ret;
|
|
493
504
|
}
|
|
494
505
|
/**
|
|
@@ -774,11 +785,6 @@ module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
|
774
785
|
console.error(arg0, arg1, arg2, arg3);
|
|
775
786
|
};
|
|
776
787
|
|
|
777
|
-
module.exports.__wbg_fetch_2025f815912fe9d0 = function(arg0) {
|
|
778
|
-
const ret = fetch(arg0);
|
|
779
|
-
return ret;
|
|
780
|
-
};
|
|
781
|
-
|
|
782
788
|
module.exports.__wbg_fetch_4465c2b10f21a927 = function(arg0) {
|
|
783
789
|
const ret = fetch(arg0);
|
|
784
790
|
return ret;
|
|
@@ -789,6 +795,11 @@ module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
|
|
|
789
795
|
return ret;
|
|
790
796
|
};
|
|
791
797
|
|
|
798
|
+
module.exports.__wbg_fetch_bb73d6305c7ef972 = function(arg0) {
|
|
799
|
+
const ret = fetch(arg0);
|
|
800
|
+
return ret;
|
|
801
|
+
};
|
|
802
|
+
|
|
792
803
|
module.exports.__wbg_getRandomValues_78e016fdd1d721cf = function() { return handleError(function (arg0, arg1) {
|
|
793
804
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
794
805
|
}, arguments) };
|
|
@@ -874,7 +885,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
874
885
|
const a = state0.a;
|
|
875
886
|
state0.a = 0;
|
|
876
887
|
try {
|
|
877
|
-
return
|
|
888
|
+
return __wbg_adapter_161(a, state0.b, arg0, arg1);
|
|
878
889
|
} finally {
|
|
879
890
|
state0.a = a;
|
|
880
891
|
}
|
|
@@ -1104,8 +1115,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1104
1115
|
return ret;
|
|
1105
1116
|
};
|
|
1106
1117
|
|
|
1107
|
-
module.exports.
|
|
1108
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1118
|
+
module.exports.__wbindgen_closure_wrapper2737 = function(arg0, arg1, arg2) {
|
|
1119
|
+
const ret = makeMutClosure(arg0, arg1, 496, __wbg_adapter_30);
|
|
1109
1120
|
return ret;
|
|
1110
1121
|
};
|
|
1111
1122
|
|