@synonymdev/pubky 0.4.2 → 0.5.0-rc.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/README.md +1 -1
- package/index.cjs +112 -63
- package/index.js +125 -71
- package/package.json +2 -2
- package/pubky.d.ts +39 -4
- package/pubky_bg.wasm +0 -0
package/README.md
CHANGED
package/index.cjs
CHANGED
|
@@ -212,6 +212,34 @@ function debugString(val) {
|
|
|
212
212
|
return className;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
function takeFromExternrefTable0(idx) {
|
|
216
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
217
|
+
wasm.__externref_table_dealloc(idx);
|
|
218
|
+
return value;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @param {string} level
|
|
222
|
+
*/
|
|
223
|
+
module.exports.setLogLevel = function(level) {
|
|
224
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.setLogLevel(ptr0, len0);
|
|
227
|
+
if (ret[1]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
233
|
+
ptr = ptr >>> 0;
|
|
234
|
+
const mem = getDataViewMemory0();
|
|
235
|
+
const result = [];
|
|
236
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
237
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
238
|
+
}
|
|
239
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
|
|
215
243
|
function _assertClass(instance, klass) {
|
|
216
244
|
if (!(instance instanceof klass)) {
|
|
217
245
|
throw new Error(`expected instance of ${klass.name}`);
|
|
@@ -238,12 +266,6 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
238
266
|
WASM_VECTOR_LEN = arg.length;
|
|
239
267
|
return ptr;
|
|
240
268
|
}
|
|
241
|
-
|
|
242
|
-
function takeFromExternrefTable0(idx) {
|
|
243
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
244
|
-
wasm.__externref_table_dealloc(idx);
|
|
245
|
-
return value;
|
|
246
|
-
}
|
|
247
269
|
/**
|
|
248
270
|
* Create a recovery file of the `keypair`, containing the secret key encrypted
|
|
249
271
|
* using the `passphrase`.
|
|
@@ -263,34 +285,20 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
|
|
|
263
285
|
return Keypair.__wrap(ret[0]);
|
|
264
286
|
};
|
|
265
287
|
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
};
|
|
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
|
+
}
|
|
277
291
|
|
|
278
|
-
function
|
|
279
|
-
|
|
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;
|
|
292
|
+
function __wbg_adapter_33(arg0, arg1) {
|
|
293
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8c6f475b193d201(arg0, arg1);
|
|
287
294
|
}
|
|
288
|
-
|
|
289
|
-
|
|
295
|
+
|
|
296
|
+
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
297
|
+
wasm.closure593_externref_shim(arg0, arg1, arg2);
|
|
290
298
|
}
|
|
291
299
|
|
|
292
|
-
function
|
|
293
|
-
wasm.
|
|
300
|
+
function __wbg_adapter_178(arg0, arg1, arg2, arg3) {
|
|
301
|
+
wasm.closure614_externref_shim(arg0, arg1, arg2, arg3);
|
|
294
302
|
}
|
|
295
303
|
|
|
296
304
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -503,11 +511,15 @@ class Client {
|
|
|
503
511
|
return ret;
|
|
504
512
|
}
|
|
505
513
|
/**
|
|
506
|
-
* Create Client with
|
|
514
|
+
* Create a new Pubky Client with an optional configuration.
|
|
515
|
+
* @param {PubkyClientConfig | null} [config_opt]
|
|
507
516
|
*/
|
|
508
|
-
constructor() {
|
|
509
|
-
const ret = wasm.client_new();
|
|
510
|
-
|
|
517
|
+
constructor(config_opt) {
|
|
518
|
+
const ret = wasm.client_new(isLikeNone(config_opt) ? 0 : addToExternrefTable0(config_opt));
|
|
519
|
+
if (ret[2]) {
|
|
520
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
521
|
+
}
|
|
522
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
511
523
|
ClientFinalization.register(this, this.__wbg_ptr, this);
|
|
512
524
|
return this;
|
|
513
525
|
}
|
|
@@ -599,7 +611,9 @@ class Keypair {
|
|
|
599
611
|
* @returns {Keypair}
|
|
600
612
|
*/
|
|
601
613
|
static fromSecretKey(secret_key) {
|
|
602
|
-
const
|
|
614
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
615
|
+
const len0 = WASM_VECTOR_LEN;
|
|
616
|
+
const ret = wasm.keypair_fromSecretKey(ptr0, len0);
|
|
603
617
|
if (ret[2]) {
|
|
604
618
|
throw takeFromExternrefTable0(ret[1]);
|
|
605
619
|
}
|
|
@@ -611,7 +625,9 @@ class Keypair {
|
|
|
611
625
|
*/
|
|
612
626
|
secretKey() {
|
|
613
627
|
const ret = wasm.keypair_secretKey(this.__wbg_ptr);
|
|
614
|
-
|
|
628
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
629
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
630
|
+
return v1;
|
|
615
631
|
}
|
|
616
632
|
/**
|
|
617
633
|
* Returns the [PublicKey] of this keypair.
|
|
@@ -651,11 +667,24 @@ class PublicKey {
|
|
|
651
667
|
}
|
|
652
668
|
/**
|
|
653
669
|
* Convert the PublicKey to Uint8Array
|
|
670
|
+
* @deprecated Use `toUint8Array` instead
|
|
654
671
|
* @returns {Uint8Array}
|
|
655
672
|
*/
|
|
656
673
|
to_uint8array() {
|
|
657
674
|
const ret = wasm.publickey_to_uint8array(this.__wbg_ptr);
|
|
658
|
-
|
|
675
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
676
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
677
|
+
return v1;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Convert the PublicKey to Uint8Array
|
|
681
|
+
* @returns {Uint8Array}
|
|
682
|
+
*/
|
|
683
|
+
toUint8Array() {
|
|
684
|
+
const ret = wasm.publickey_toUint8Array(this.__wbg_ptr);
|
|
685
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
686
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
687
|
+
return v1;
|
|
659
688
|
}
|
|
660
689
|
/**
|
|
661
690
|
* Returns the z-base32 encoding of this public key
|
|
@@ -675,11 +704,13 @@ class PublicKey {
|
|
|
675
704
|
}
|
|
676
705
|
/**
|
|
677
706
|
* @throws
|
|
678
|
-
* @param {
|
|
707
|
+
* @param {string} value
|
|
679
708
|
* @returns {PublicKey}
|
|
680
709
|
*/
|
|
681
710
|
static from(value) {
|
|
682
|
-
const
|
|
711
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
712
|
+
const len0 = WASM_VECTOR_LEN;
|
|
713
|
+
const ret = wasm.publickey_from(ptr0, len0);
|
|
683
714
|
if (ret[2]) {
|
|
684
715
|
throw takeFromExternrefTable0(ret[1]);
|
|
685
716
|
}
|
|
@@ -734,6 +765,10 @@ class Session {
|
|
|
734
765
|
}
|
|
735
766
|
module.exports.Session = Session;
|
|
736
767
|
|
|
768
|
+
module.exports.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
|
|
769
|
+
arg0.abort(arg1);
|
|
770
|
+
};
|
|
771
|
+
|
|
737
772
|
module.exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
738
773
|
arg0.abort();
|
|
739
774
|
};
|
|
@@ -752,11 +787,6 @@ module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
|
752
787
|
return ret;
|
|
753
788
|
};
|
|
754
789
|
|
|
755
|
-
module.exports.__wbg_byteLength_e674b853d9c77e1d = function(arg0) {
|
|
756
|
-
const ret = arg0.byteLength;
|
|
757
|
-
return ret;
|
|
758
|
-
};
|
|
759
|
-
|
|
760
790
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
761
791
|
const ret = arg0.call(arg1);
|
|
762
792
|
return ret;
|
|
@@ -767,6 +797,16 @@ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(fun
|
|
|
767
797
|
return ret;
|
|
768
798
|
}, arguments) };
|
|
769
799
|
|
|
800
|
+
module.exports.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) {
|
|
801
|
+
const ret = clearTimeout(arg0);
|
|
802
|
+
return ret;
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
module.exports.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
|
|
806
|
+
const ret = clearTimeout(arg0);
|
|
807
|
+
return ret;
|
|
808
|
+
};
|
|
809
|
+
|
|
770
810
|
module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
771
811
|
const ret = arg0.crypto;
|
|
772
812
|
return ret;
|
|
@@ -785,17 +825,17 @@ module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
|
785
825
|
console.error(arg0, arg1, arg2, arg3);
|
|
786
826
|
};
|
|
787
827
|
|
|
788
|
-
module.exports.
|
|
789
|
-
const ret = fetch(
|
|
828
|
+
module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
|
|
829
|
+
const ret = arg0.fetch(arg1);
|
|
790
830
|
return ret;
|
|
791
831
|
};
|
|
792
832
|
|
|
793
|
-
module.exports.
|
|
794
|
-
const ret =
|
|
833
|
+
module.exports.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
834
|
+
const ret = fetch(arg0);
|
|
795
835
|
return ret;
|
|
796
836
|
};
|
|
797
837
|
|
|
798
|
-
module.exports.
|
|
838
|
+
module.exports.__wbg_fetch_ef1ee463f5f01666 = function(arg0) {
|
|
799
839
|
const ret = fetch(arg0);
|
|
800
840
|
return ret;
|
|
801
841
|
};
|
|
@@ -843,17 +883,6 @@ module.exports.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
|
|
|
843
883
|
return ret;
|
|
844
884
|
};
|
|
845
885
|
|
|
846
|
-
module.exports.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
|
|
847
|
-
let result;
|
|
848
|
-
try {
|
|
849
|
-
result = arg0 instanceof Uint8Array;
|
|
850
|
-
} catch (_) {
|
|
851
|
-
result = false;
|
|
852
|
-
}
|
|
853
|
-
const ret = result;
|
|
854
|
-
return ret;
|
|
855
|
-
};
|
|
856
|
-
|
|
857
886
|
module.exports.__wbg_iterator_9a24c88df860dc65 = function() {
|
|
858
887
|
const ret = Symbol.iterator;
|
|
859
888
|
return ret;
|
|
@@ -885,7 +914,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
885
914
|
const a = state0.a;
|
|
886
915
|
state0.a = 0;
|
|
887
916
|
try {
|
|
888
|
-
return
|
|
917
|
+
return __wbg_adapter_178(a, state0.b, arg0, arg1);
|
|
889
918
|
} finally {
|
|
890
919
|
state0.a = a;
|
|
891
920
|
}
|
|
@@ -1000,6 +1029,16 @@ module.exports.__wbg_session_new = function(arg0) {
|
|
|
1000
1029
|
return ret;
|
|
1001
1030
|
};
|
|
1002
1031
|
|
|
1032
|
+
module.exports.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
|
|
1033
|
+
const ret = setTimeout(arg0, arg1);
|
|
1034
|
+
return ret;
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
module.exports.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
|
|
1038
|
+
const ret = setTimeout(arg0, arg1);
|
|
1039
|
+
return ret;
|
|
1040
|
+
}, arguments) };
|
|
1041
|
+
|
|
1003
1042
|
module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
1004
1043
|
arg0.set(arg1, arg2 >>> 0);
|
|
1005
1044
|
};
|
|
@@ -1115,8 +1154,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1115
1154
|
return ret;
|
|
1116
1155
|
};
|
|
1117
1156
|
|
|
1118
|
-
module.exports.
|
|
1119
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1157
|
+
module.exports.__wbindgen_closure_wrapper1043 = function(arg0, arg1, arg2) {
|
|
1158
|
+
const ret = makeMutClosure(arg0, arg1, 285, __wbg_adapter_30);
|
|
1159
|
+
return ret;
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
module.exports.__wbindgen_closure_wrapper2822 = function(arg0, arg1, arg2) {
|
|
1163
|
+
const ret = makeMutClosure(arg0, arg1, 579, __wbg_adapter_33);
|
|
1164
|
+
return ret;
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
module.exports.__wbindgen_closure_wrapper3083 = function(arg0, arg1, arg2) {
|
|
1168
|
+
const ret = makeMutClosure(arg0, arg1, 594, __wbg_adapter_36);
|
|
1120
1169
|
return ret;
|
|
1121
1170
|
};
|
|
1122
1171
|
|