@functionland/fula-client 0.2.12 → 0.2.13
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/fula_js.d.ts +20 -5
- package/fula_js.js +44 -9
- package/fula_js_bg.wasm +0 -0
- package/package.json +1 -1
package/fula_js.d.ts
CHANGED
|
@@ -56,6 +56,20 @@ export function deleteEncrypted(client: EncryptedClient, bucket: string, key: st
|
|
|
56
56
|
*/
|
|
57
57
|
export function deriveKey(context: string, input: Uint8Array): Uint8Array;
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Derive X25519 public key from private key bytes
|
|
61
|
+
*
|
|
62
|
+
* **IMPORTANT**: Use this function to ensure compatibility between
|
|
63
|
+
* Flutter/Native and Web/WASM clients when sharing files.
|
|
64
|
+
*
|
|
65
|
+
* This ensures both sender and receiver derive the exact same public key
|
|
66
|
+
* from the same private key bytes, avoiding cryptographic mismatches.
|
|
67
|
+
*
|
|
68
|
+
* @param secretKeyBytes - 32-byte X25519 private key (Uint8Array)
|
|
69
|
+
* @returns 32-byte X25519 public key (Uint8Array)
|
|
70
|
+
*/
|
|
71
|
+
export function derivePublicKeyFromSecret(secret_key_bytes: Uint8Array): Uint8Array;
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* Export the secret key for backup (32 bytes)
|
|
61
75
|
*
|
|
@@ -178,6 +192,7 @@ export interface InitOutput {
|
|
|
178
192
|
readonly deleteBucket: (a: number, b: number, c: number) => number;
|
|
179
193
|
readonly deleteEncrypted: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
180
194
|
readonly deriveKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
195
|
+
readonly derivePublicKeyFromSecret: (a: number, b: number, c: number) => void;
|
|
181
196
|
readonly exportSecretKey: (a: number) => number;
|
|
182
197
|
readonly getDecrypted: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
183
198
|
readonly getDecryptedByStorageKey: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
@@ -194,11 +209,11 @@ export interface InitOutput {
|
|
|
194
209
|
readonly putEncrypted: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
195
210
|
readonly putEncryptedWithType: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
196
211
|
readonly init: () => void;
|
|
197
|
-
readonly
|
|
198
|
-
readonly
|
|
199
|
-
readonly
|
|
200
|
-
readonly
|
|
201
|
-
readonly
|
|
212
|
+
readonly __wasm_bindgen_func_elem_1053: (a: number, b: number, c: number) => void;
|
|
213
|
+
readonly __wasm_bindgen_func_elem_1052: (a: number, b: number) => void;
|
|
214
|
+
readonly __wasm_bindgen_func_elem_981: (a: number, b: number) => void;
|
|
215
|
+
readonly __wasm_bindgen_func_elem_980: (a: number, b: number) => void;
|
|
216
|
+
readonly __wasm_bindgen_func_elem_1451: (a: number, b: number, c: number, d: number) => void;
|
|
202
217
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
203
218
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
204
219
|
readonly __wbindgen_export3: (a: number) => void;
|
package/fula_js.js
CHANGED
|
@@ -242,16 +242,16 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
242
242
|
|
|
243
243
|
let WASM_VECTOR_LEN = 0;
|
|
244
244
|
|
|
245
|
-
function
|
|
246
|
-
wasm.
|
|
245
|
+
function __wasm_bindgen_func_elem_1053(arg0, arg1, arg2) {
|
|
246
|
+
wasm.__wasm_bindgen_func_elem_1053(arg0, arg1, addHeapObject(arg2));
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
function
|
|
250
|
-
wasm.
|
|
249
|
+
function __wasm_bindgen_func_elem_981(arg0, arg1) {
|
|
250
|
+
wasm.__wasm_bindgen_func_elem_981(arg0, arg1);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
function
|
|
254
|
-
wasm.
|
|
253
|
+
function __wasm_bindgen_func_elem_1451(arg0, arg1, arg2, arg3) {
|
|
254
|
+
wasm.__wasm_bindgen_func_elem_1451(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
@@ -423,6 +423,41 @@ export function deriveKey(context, input) {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Derive X25519 public key from private key bytes
|
|
428
|
+
*
|
|
429
|
+
* **IMPORTANT**: Use this function to ensure compatibility between
|
|
430
|
+
* Flutter/Native and Web/WASM clients when sharing files.
|
|
431
|
+
*
|
|
432
|
+
* This ensures both sender and receiver derive the exact same public key
|
|
433
|
+
* from the same private key bytes, avoiding cryptographic mismatches.
|
|
434
|
+
*
|
|
435
|
+
* @param secretKeyBytes - 32-byte X25519 private key (Uint8Array)
|
|
436
|
+
* @returns 32-byte X25519 public key (Uint8Array)
|
|
437
|
+
* @param {Uint8Array} secret_key_bytes
|
|
438
|
+
* @returns {Uint8Array}
|
|
439
|
+
*/
|
|
440
|
+
export function derivePublicKeyFromSecret(secret_key_bytes) {
|
|
441
|
+
try {
|
|
442
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
443
|
+
const ptr0 = passArray8ToWasm0(secret_key_bytes, wasm.__wbindgen_export);
|
|
444
|
+
const len0 = WASM_VECTOR_LEN;
|
|
445
|
+
wasm.derivePublicKeyFromSecret(retptr, ptr0, len0);
|
|
446
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
447
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
448
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
449
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
450
|
+
if (r3) {
|
|
451
|
+
throw takeObject(r2);
|
|
452
|
+
}
|
|
453
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
454
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
455
|
+
return v2;
|
|
456
|
+
} finally {
|
|
457
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
426
461
|
/**
|
|
427
462
|
* Export the secret key for backup (32 bytes)
|
|
428
463
|
*
|
|
@@ -1007,7 +1042,7 @@ function __wbg_get_imports() {
|
|
|
1007
1042
|
const a = state0.a;
|
|
1008
1043
|
state0.a = 0;
|
|
1009
1044
|
try {
|
|
1010
|
-
return
|
|
1045
|
+
return __wasm_bindgen_func_elem_1451(a, state0.b, arg0, arg1);
|
|
1011
1046
|
} finally {
|
|
1012
1047
|
state0.a = a;
|
|
1013
1048
|
}
|
|
@@ -1174,7 +1209,7 @@ function __wbg_get_imports() {
|
|
|
1174
1209
|
};
|
|
1175
1210
|
imports.wbg.__wbindgen_cast_04a5579367ffcd92 = function(arg0, arg1) {
|
|
1176
1211
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 283, function: Function { arguments: [], shim_idx: 284, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1177
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1212
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_980, __wasm_bindgen_func_elem_981);
|
|
1178
1213
|
return addHeapObject(ret);
|
|
1179
1214
|
};
|
|
1180
1215
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -1189,7 +1224,7 @@ function __wbg_get_imports() {
|
|
|
1189
1224
|
};
|
|
1190
1225
|
imports.wbg.__wbindgen_cast_5885937ba6005174 = function(arg0, arg1) {
|
|
1191
1226
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 318, function: Function { arguments: [Externref], shim_idx: 319, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1192
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1227
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1052, __wasm_bindgen_func_elem_1053);
|
|
1193
1228
|
return addHeapObject(ret);
|
|
1194
1229
|
};
|
|
1195
1230
|
imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
|
package/fula_js_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionland/fula-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript/TypeScript SDK for Fula decentralized storage - client-side encryption with cross-platform key compatibility",
|
|
6
6
|
"main": "fula_js.js",
|