@synonymdev/pubky 0.5.1 → 0.5.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 -80
- package/index.js +69 -100
- package/package.json +1 -1
- package/pubky.d.ts +0 -197
- package/pubky_bg.wasm +0 -0
package/index.cjs
CHANGED
|
@@ -284,20 +284,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
284
284
|
wasm.__externref_drop_slice(ptr, len);
|
|
285
285
|
return result;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
wasm.
|
|
287
|
+
function __wbg_adapter_28(arg0, arg1) {
|
|
288
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h76b7e185a7848c9a(arg0, arg1);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
function
|
|
292
|
-
wasm.
|
|
291
|
+
function __wbg_adapter_31(arg0, arg1, arg2) {
|
|
292
|
+
wasm.closure650_externref_shim(arg0, arg1, arg2);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
function
|
|
296
|
-
wasm.
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function __wbg_adapter_178(arg0, arg1, arg2, arg3) {
|
|
300
|
-
wasm.closure622_externref_shim(arg0, arg1, arg2, arg3);
|
|
295
|
+
function __wbg_adapter_167(arg0, arg1, arg2, arg3) {
|
|
296
|
+
wasm.closure767_externref_shim(arg0, arg1, arg2, arg3);
|
|
301
297
|
}
|
|
302
298
|
|
|
303
299
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -389,27 +385,14 @@ class Client {
|
|
|
389
385
|
wasm.__wbg_client_free(ptr, 0);
|
|
390
386
|
}
|
|
391
387
|
/**
|
|
392
|
-
* Returns a list of Pubky urls (as strings).
|
|
393
|
-
*
|
|
394
|
-
* - `url`: The Pubky url (string) to the directory you want to list its content.
|
|
395
|
-
* - `cursor`: Either a full `pubky://` Url (from previous list response),
|
|
396
|
-
* or a path (to a file or directory) relative to the `url`
|
|
397
|
-
* - `reverse`: List in reverse order
|
|
398
|
-
* - `limit` Limit the number of urls in the response
|
|
399
|
-
* - `shallow`: List directories and files, instead of flat list of files.
|
|
400
388
|
* @param {string} url
|
|
401
|
-
* @param {
|
|
402
|
-
* @
|
|
403
|
-
* @param {number | null} [limit]
|
|
404
|
-
* @param {boolean | null} [shallow]
|
|
405
|
-
* @returns {Promise<Array<any>>}
|
|
389
|
+
* @param {any | null} [init]
|
|
390
|
+
* @returns {Promise<Promise<any>>}
|
|
406
391
|
*/
|
|
407
|
-
|
|
392
|
+
fetch(url, init) {
|
|
408
393
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
409
394
|
const len0 = WASM_VECTOR_LEN;
|
|
410
|
-
|
|
411
|
-
var len1 = WASM_VECTOR_LEN;
|
|
412
|
-
const ret = wasm.client_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
|
|
395
|
+
const ret = wasm.client_fetch(this.__wbg_ptr, ptr0, len0, isLikeNone(init) ? 0 : addToExternrefTable0(init));
|
|
413
396
|
return ret;
|
|
414
397
|
}
|
|
415
398
|
/**
|
|
@@ -534,14 +517,27 @@ class Client {
|
|
|
534
517
|
return ret;
|
|
535
518
|
}
|
|
536
519
|
/**
|
|
520
|
+
* Returns a list of Pubky urls (as strings).
|
|
521
|
+
*
|
|
522
|
+
* - `url`: The Pubky url (string) to the directory you want to list its content.
|
|
523
|
+
* - `cursor`: Either a full `pubky://` Url (from previous list response),
|
|
524
|
+
* or a path (to a file or directory) relative to the `url`
|
|
525
|
+
* - `reverse`: List in reverse order
|
|
526
|
+
* - `limit` Limit the number of urls in the response
|
|
527
|
+
* - `shallow`: List directories and files, instead of flat list of files.
|
|
537
528
|
* @param {string} url
|
|
538
|
-
* @param {
|
|
539
|
-
* @
|
|
529
|
+
* @param {string | null} [cursor]
|
|
530
|
+
* @param {boolean | null} [reverse]
|
|
531
|
+
* @param {number | null} [limit]
|
|
532
|
+
* @param {boolean | null} [shallow]
|
|
533
|
+
* @returns {Promise<Array<any>>}
|
|
540
534
|
*/
|
|
541
|
-
|
|
535
|
+
list(url, cursor, reverse, limit, shallow) {
|
|
542
536
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
543
537
|
const len0 = WASM_VECTOR_LEN;
|
|
544
|
-
|
|
538
|
+
var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
539
|
+
var len1 = WASM_VECTOR_LEN;
|
|
540
|
+
const ret = wasm.client_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
|
|
545
541
|
return ret;
|
|
546
542
|
}
|
|
547
543
|
/**
|
|
@@ -559,13 +555,16 @@ class Client {
|
|
|
559
555
|
}
|
|
560
556
|
/**
|
|
561
557
|
* Create a client with with configurations appropriate for local testing:
|
|
562
|
-
* - set Pkarr relays to `
|
|
563
|
-
* - transform `pubky://<pkarr public key>` to `http://<
|
|
564
|
-
*
|
|
558
|
+
* - set Pkarr relays to `http://<host>:15411` (defaults to `localhost`).
|
|
559
|
+
* - transform `pubky://<pkarr public key>` to `http://<host>` instead of `https:`
|
|
560
|
+
* and read the homeserver HTTP port from the PKarr record.
|
|
561
|
+
* @param {string | null} [host]
|
|
565
562
|
* @returns {Client}
|
|
566
563
|
*/
|
|
567
|
-
static testnet() {
|
|
568
|
-
|
|
564
|
+
static testnet(host) {
|
|
565
|
+
var ptr0 = isLikeNone(host) ? 0 : passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
566
|
+
var len0 = WASM_VECTOR_LEN;
|
|
567
|
+
const ret = wasm.client_testnet(ptr0, len0);
|
|
569
568
|
return Client.__wrap(ret);
|
|
570
569
|
}
|
|
571
570
|
}
|
|
@@ -796,17 +795,12 @@ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(fun
|
|
|
796
795
|
return ret;
|
|
797
796
|
}, arguments) };
|
|
798
797
|
|
|
799
|
-
module.exports.
|
|
800
|
-
const ret = clearTimeout(arg0);
|
|
801
|
-
return ret;
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
module.exports.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
|
|
798
|
+
module.exports.__wbg_clearTimeout_0b53d391c1b94dda = function(arg0) {
|
|
805
799
|
const ret = clearTimeout(arg0);
|
|
806
800
|
return ret;
|
|
807
801
|
};
|
|
808
802
|
|
|
809
|
-
module.exports.
|
|
803
|
+
module.exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
810
804
|
const ret = arg0.crypto;
|
|
811
805
|
return ret;
|
|
812
806
|
};
|
|
@@ -824,7 +818,7 @@ module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
|
824
818
|
console.error(arg0, arg1, arg2, arg3);
|
|
825
819
|
};
|
|
826
820
|
|
|
827
|
-
module.exports.
|
|
821
|
+
module.exports.__wbg_fetch_11bff8299d0ecd2b = function(arg0) {
|
|
828
822
|
const ret = fetch(arg0);
|
|
829
823
|
return ret;
|
|
830
824
|
};
|
|
@@ -834,16 +828,16 @@ module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
|
|
|
834
828
|
return ret;
|
|
835
829
|
};
|
|
836
830
|
|
|
837
|
-
module.exports.
|
|
831
|
+
module.exports.__wbg_fetch_de12f9389c1d3a90 = function(arg0) {
|
|
838
832
|
const ret = fetch(arg0);
|
|
839
833
|
return ret;
|
|
840
834
|
};
|
|
841
835
|
|
|
842
|
-
module.exports.
|
|
836
|
+
module.exports.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
|
|
843
837
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
844
838
|
}, arguments) };
|
|
845
839
|
|
|
846
|
-
module.exports.
|
|
840
|
+
module.exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
847
841
|
arg0.getRandomValues(arg1);
|
|
848
842
|
}, arguments) };
|
|
849
843
|
|
|
@@ -852,11 +846,6 @@ module.exports.__wbg_get_67b2ba62fc30de12 = function() { return handleError(func
|
|
|
852
846
|
return ret;
|
|
853
847
|
}, arguments) };
|
|
854
848
|
|
|
855
|
-
module.exports.__wbg_getheaders_8326221cf02f205d = function(arg0) {
|
|
856
|
-
const ret = arg0.headers;
|
|
857
|
-
return ret;
|
|
858
|
-
};
|
|
859
|
-
|
|
860
849
|
module.exports.__wbg_has_a5ea9117f258a0ec = function() { return handleError(function (arg0, arg1) {
|
|
861
850
|
const ret = Reflect.has(arg0, arg1);
|
|
862
851
|
return ret;
|
|
@@ -896,7 +885,7 @@ module.exports.__wbg_log_cad59bb680daec67 = function(arg0, arg1, arg2, arg3) {
|
|
|
896
885
|
console.log(arg0, arg1, arg2, arg3);
|
|
897
886
|
};
|
|
898
887
|
|
|
899
|
-
module.exports.
|
|
888
|
+
module.exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
900
889
|
const ret = arg0.msCrypto;
|
|
901
890
|
return ret;
|
|
902
891
|
};
|
|
@@ -913,7 +902,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
913
902
|
const a = state0.a;
|
|
914
903
|
state0.a = 0;
|
|
915
904
|
try {
|
|
916
|
-
return
|
|
905
|
+
return __wbg_adapter_167(a, state0.b, arg0, arg1);
|
|
917
906
|
} finally {
|
|
918
907
|
state0.a = a;
|
|
919
908
|
}
|
|
@@ -975,7 +964,7 @@ module.exports.__wbg_next_6574e1a8a62d1055 = function() { return handleError(fun
|
|
|
975
964
|
return ret;
|
|
976
965
|
}, arguments) };
|
|
977
966
|
|
|
978
|
-
module.exports.
|
|
967
|
+
module.exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
979
968
|
const ret = arg0.node;
|
|
980
969
|
return ret;
|
|
981
970
|
};
|
|
@@ -985,7 +974,7 @@ module.exports.__wbg_now_807e54c39636c349 = function() {
|
|
|
985
974
|
return ret;
|
|
986
975
|
};
|
|
987
976
|
|
|
988
|
-
module.exports.
|
|
977
|
+
module.exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
989
978
|
const ret = arg0.process;
|
|
990
979
|
return ret;
|
|
991
980
|
};
|
|
@@ -1009,11 +998,11 @@ module.exports.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
|
|
|
1009
998
|
return ret;
|
|
1010
999
|
};
|
|
1011
1000
|
|
|
1012
|
-
module.exports.
|
|
1001
|
+
module.exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
1013
1002
|
arg0.randomFillSync(arg1);
|
|
1014
1003
|
}, arguments) };
|
|
1015
1004
|
|
|
1016
|
-
module.exports.
|
|
1005
|
+
module.exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
1017
1006
|
const ret = module.require;
|
|
1018
1007
|
return ret;
|
|
1019
1008
|
}, arguments) };
|
|
@@ -1028,16 +1017,11 @@ module.exports.__wbg_session_new = function(arg0) {
|
|
|
1028
1017
|
return ret;
|
|
1029
1018
|
};
|
|
1030
1019
|
|
|
1031
|
-
module.exports.
|
|
1020
|
+
module.exports.__wbg_setTimeout_73ce8df12de4f2f2 = function(arg0, arg1) {
|
|
1032
1021
|
const ret = setTimeout(arg0, arg1);
|
|
1033
1022
|
return ret;
|
|
1034
1023
|
};
|
|
1035
1024
|
|
|
1036
|
-
module.exports.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
|
|
1037
|
-
const ret = setTimeout(arg0, arg1);
|
|
1038
|
-
return ret;
|
|
1039
|
-
}, arguments) };
|
|
1040
|
-
|
|
1041
1025
|
module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
1042
1026
|
arg0.set(arg1, arg2 >>> 0);
|
|
1043
1027
|
};
|
|
@@ -1134,7 +1118,7 @@ module.exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
|
|
|
1134
1118
|
return ret;
|
|
1135
1119
|
};
|
|
1136
1120
|
|
|
1137
|
-
module.exports.
|
|
1121
|
+
module.exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
1138
1122
|
const ret = arg0.versions;
|
|
1139
1123
|
return ret;
|
|
1140
1124
|
};
|
|
@@ -1153,18 +1137,13 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1153
1137
|
return ret;
|
|
1154
1138
|
};
|
|
1155
1139
|
|
|
1156
|
-
module.exports.
|
|
1157
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1158
|
-
return ret;
|
|
1159
|
-
};
|
|
1160
|
-
|
|
1161
|
-
module.exports.__wbindgen_closure_wrapper2891 = function(arg0, arg1, arg2) {
|
|
1162
|
-
const ret = makeMutClosure(arg0, arg1, 565, __wbg_adapter_33);
|
|
1140
|
+
module.exports.__wbindgen_closure_wrapper1409 = function(arg0, arg1, arg2) {
|
|
1141
|
+
const ret = makeMutClosure(arg0, arg1, 624, __wbg_adapter_28);
|
|
1163
1142
|
return ret;
|
|
1164
1143
|
};
|
|
1165
1144
|
|
|
1166
|
-
module.exports.
|
|
1167
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1145
|
+
module.exports.__wbindgen_closure_wrapper1514 = function(arg0, arg1, arg2) {
|
|
1146
|
+
const ret = makeMutClosure(arg0, arg1, 651, __wbg_adapter_31);
|
|
1168
1147
|
return ret;
|
|
1169
1148
|
};
|
|
1170
1149
|
|
|
@@ -1192,11 +1171,6 @@ module.exports.__wbindgen_is_function = function(arg0) {
|
|
|
1192
1171
|
return ret;
|
|
1193
1172
|
};
|
|
1194
1173
|
|
|
1195
|
-
module.exports.__wbindgen_is_null = function(arg0) {
|
|
1196
|
-
const ret = arg0 === null;
|
|
1197
|
-
return ret;
|
|
1198
|
-
};
|
|
1199
|
-
|
|
1200
1174
|
module.exports.__wbindgen_is_object = function(arg0) {
|
|
1201
1175
|
const val = arg0;
|
|
1202
1176
|
const ret = typeof(val) === 'object' && val !== null;
|
|
@@ -1236,7 +1210,7 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
1236
1210
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1237
1211
|
};
|
|
1238
1212
|
|
|
1239
|
-
const path = require('path').join(__dirname, '
|
|
1213
|
+
const path = require('path').join(__dirname, 'pubky_wasm_bg.wasm');
|
|
1240
1214
|
const bytes = require('fs').readFileSync(path);
|
|
1241
1215
|
|
|
1242
1216
|
const wasmModule = new WebAssembly.Module(bytes);
|