@synonymdev/pubky 0.5.0-rc.1 → 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/index.cjs +72 -65
- package/index.js +78 -73
- package/package.json +1 -1
- package/pubky.d.ts +39 -4
- package/pubky_bg.wasm +0 -0
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,42 +285,20 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
|
|
|
263
285
|
return Keypair.__wrap(ret[0]);
|
|
264
286
|
};
|
|
265
287
|
|
|
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) {
|
|
289
289
|
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h65148d1329d3fd27(arg0, arg1);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
function __wbg_adapter_33(arg0, arg1) {
|
|
293
|
-
wasm.
|
|
293
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8c6f475b193d201(arg0, arg1);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
297
|
-
wasm.
|
|
297
|
+
wasm.closure593_externref_shim(arg0, arg1, arg2);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
function
|
|
301
|
-
wasm.
|
|
300
|
+
function __wbg_adapter_178(arg0, arg1, arg2, arg3) {
|
|
301
|
+
wasm.closure614_externref_shim(arg0, arg1, arg2, arg3);
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -511,11 +511,15 @@ class Client {
|
|
|
511
511
|
return ret;
|
|
512
512
|
}
|
|
513
513
|
/**
|
|
514
|
-
* Create Client with
|
|
514
|
+
* Create a new Pubky Client with an optional configuration.
|
|
515
|
+
* @param {PubkyClientConfig | null} [config_opt]
|
|
515
516
|
*/
|
|
516
|
-
constructor() {
|
|
517
|
-
const ret = wasm.client_new();
|
|
518
|
-
|
|
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;
|
|
519
523
|
ClientFinalization.register(this, this.__wbg_ptr, this);
|
|
520
524
|
return this;
|
|
521
525
|
}
|
|
@@ -607,7 +611,9 @@ class Keypair {
|
|
|
607
611
|
* @returns {Keypair}
|
|
608
612
|
*/
|
|
609
613
|
static fromSecretKey(secret_key) {
|
|
610
|
-
const
|
|
614
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
|
|
615
|
+
const len0 = WASM_VECTOR_LEN;
|
|
616
|
+
const ret = wasm.keypair_fromSecretKey(ptr0, len0);
|
|
611
617
|
if (ret[2]) {
|
|
612
618
|
throw takeFromExternrefTable0(ret[1]);
|
|
613
619
|
}
|
|
@@ -619,7 +625,9 @@ class Keypair {
|
|
|
619
625
|
*/
|
|
620
626
|
secretKey() {
|
|
621
627
|
const ret = wasm.keypair_secretKey(this.__wbg_ptr);
|
|
622
|
-
|
|
628
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
629
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
630
|
+
return v1;
|
|
623
631
|
}
|
|
624
632
|
/**
|
|
625
633
|
* Returns the [PublicKey] of this keypair.
|
|
@@ -659,11 +667,24 @@ class PublicKey {
|
|
|
659
667
|
}
|
|
660
668
|
/**
|
|
661
669
|
* Convert the PublicKey to Uint8Array
|
|
670
|
+
* @deprecated Use `toUint8Array` instead
|
|
662
671
|
* @returns {Uint8Array}
|
|
663
672
|
*/
|
|
664
673
|
to_uint8array() {
|
|
665
674
|
const ret = wasm.publickey_to_uint8array(this.__wbg_ptr);
|
|
666
|
-
|
|
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;
|
|
667
688
|
}
|
|
668
689
|
/**
|
|
669
690
|
* Returns the z-base32 encoding of this public key
|
|
@@ -683,11 +704,13 @@ class PublicKey {
|
|
|
683
704
|
}
|
|
684
705
|
/**
|
|
685
706
|
* @throws
|
|
686
|
-
* @param {
|
|
707
|
+
* @param {string} value
|
|
687
708
|
* @returns {PublicKey}
|
|
688
709
|
*/
|
|
689
710
|
static from(value) {
|
|
690
|
-
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);
|
|
691
714
|
if (ret[2]) {
|
|
692
715
|
throw takeFromExternrefTable0(ret[1]);
|
|
693
716
|
}
|
|
@@ -764,11 +787,6 @@ module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
|
764
787
|
return ret;
|
|
765
788
|
};
|
|
766
789
|
|
|
767
|
-
module.exports.__wbg_byteLength_e674b853d9c77e1d = function(arg0) {
|
|
768
|
-
const ret = arg0.byteLength;
|
|
769
|
-
return ret;
|
|
770
|
-
};
|
|
771
|
-
|
|
772
790
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
773
791
|
const ret = arg0.call(arg1);
|
|
774
792
|
return ret;
|
|
@@ -817,7 +835,7 @@ module.exports.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
|
817
835
|
return ret;
|
|
818
836
|
};
|
|
819
837
|
|
|
820
|
-
module.exports.
|
|
838
|
+
module.exports.__wbg_fetch_ef1ee463f5f01666 = function(arg0) {
|
|
821
839
|
const ret = fetch(arg0);
|
|
822
840
|
return ret;
|
|
823
841
|
};
|
|
@@ -865,17 +883,6 @@ module.exports.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
|
|
|
865
883
|
return ret;
|
|
866
884
|
};
|
|
867
885
|
|
|
868
|
-
module.exports.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
|
|
869
|
-
let result;
|
|
870
|
-
try {
|
|
871
|
-
result = arg0 instanceof Uint8Array;
|
|
872
|
-
} catch (_) {
|
|
873
|
-
result = false;
|
|
874
|
-
}
|
|
875
|
-
const ret = result;
|
|
876
|
-
return ret;
|
|
877
|
-
};
|
|
878
|
-
|
|
879
886
|
module.exports.__wbg_iterator_9a24c88df860dc65 = function() {
|
|
880
887
|
const ret = Symbol.iterator;
|
|
881
888
|
return ret;
|
|
@@ -907,7 +914,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
907
914
|
const a = state0.a;
|
|
908
915
|
state0.a = 0;
|
|
909
916
|
try {
|
|
910
|
-
return
|
|
917
|
+
return __wbg_adapter_178(a, state0.b, arg0, arg1);
|
|
911
918
|
} finally {
|
|
912
919
|
state0.a = a;
|
|
913
920
|
}
|
|
@@ -1147,18 +1154,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1147
1154
|
return ret;
|
|
1148
1155
|
};
|
|
1149
1156
|
|
|
1150
|
-
module.exports.
|
|
1151
|
-
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);
|
|
1152
1159
|
return ret;
|
|
1153
1160
|
};
|
|
1154
1161
|
|
|
1155
|
-
module.exports.
|
|
1156
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1162
|
+
module.exports.__wbindgen_closure_wrapper2822 = function(arg0, arg1, arg2) {
|
|
1163
|
+
const ret = makeMutClosure(arg0, arg1, 579, __wbg_adapter_33);
|
|
1157
1164
|
return ret;
|
|
1158
1165
|
};
|
|
1159
1166
|
|
|
1160
|
-
module.exports.
|
|
1161
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1167
|
+
module.exports.__wbindgen_closure_wrapper3083 = function(arg0, arg1, arg2) {
|
|
1168
|
+
const ret = makeMutClosure(arg0, arg1, 594, __wbg_adapter_36);
|
|
1162
1169
|
return ret;
|
|
1163
1170
|
};
|
|
1164
1171
|
|