tkms 0.9.0-rc3 → 0.9.0-rc5
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/LICENSE +28 -0
- package/kms_lib.d.ts +27 -27
- package/kms_lib.js +21 -35
- package/kms_lib_bg.wasm +0 -0
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause Clear License
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 ZAMA.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
7
|
+
are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this
|
|
13
|
+
list of conditions and the following disclaimer in the documentation and/or other
|
|
14
|
+
materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of ZAMA nor the names of its contributors may be used to endorse
|
|
17
|
+
or promote products derived from this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE ZAMA AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
21
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
22
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
23
|
+
ZAMA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
24
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
25
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
26
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
27
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
28
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/kms_lib.d.ts
CHANGED
|
@@ -31,17 +31,17 @@ export function u8vec_to_private_sig_key(v: Uint8Array): PrivateSigKey;
|
|
|
31
31
|
*
|
|
32
32
|
* * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
|
|
33
33
|
* The "default" parameter choice is selected if no matching string is found.
|
|
34
|
-
* @param {(
|
|
34
|
+
* @param {(string)[]} server_addrs
|
|
35
35
|
* @param {string} client_address_hex
|
|
36
36
|
* @param {string} param_choice
|
|
37
37
|
* @returns {Client}
|
|
38
38
|
*/
|
|
39
|
-
export function new_client(
|
|
39
|
+
export function new_client(server_addrs: (string)[], client_address_hex: string, param_choice: string): Client;
|
|
40
40
|
/**
|
|
41
41
|
* @param {Client} client
|
|
42
|
-
* @returns {(
|
|
42
|
+
* @returns {(string)[]}
|
|
43
43
|
*/
|
|
44
|
-
export function
|
|
44
|
+
export function get_server_addrs(client: Client): (string)[];
|
|
45
45
|
/**
|
|
46
46
|
* @param {Client} client
|
|
47
47
|
* @returns {PrivateSigKey | undefined}
|
|
@@ -410,29 +410,6 @@ export interface InitOutput {
|
|
|
410
410
|
readonly memory: WebAssembly.Memory;
|
|
411
411
|
readonly __wbg_client_free: (a: number, b: number) => void;
|
|
412
412
|
readonly __wbg_parsedreencryptionrequest_free: (a: number, b: number) => void;
|
|
413
|
-
readonly __wbg_publicenckey_free: (a: number, b: number) => void;
|
|
414
|
-
readonly __wbg_privateenckey_free: (a: number, b: number) => void;
|
|
415
|
-
readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
|
|
416
|
-
readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
|
|
417
|
-
readonly public_sig_key_to_u8vec: (a: number, b: number) => void;
|
|
418
|
-
readonly u8vec_to_public_sig_key: (a: number, b: number, c: number) => void;
|
|
419
|
-
readonly private_sig_key_to_u8vec: (a: number, b: number) => void;
|
|
420
|
-
readonly u8vec_to_private_sig_key: (a: number, b: number, c: number) => void;
|
|
421
|
-
readonly new_client: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
422
|
-
readonly get_server_public_keys: (a: number, b: number) => void;
|
|
423
|
-
readonly get_client_secret_key: (a: number) => number;
|
|
424
|
-
readonly get_client_address: (a: number, b: number) => void;
|
|
425
|
-
readonly __wbg_cryptoboxct_free: (a: number, b: number) => void;
|
|
426
|
-
readonly cryptobox_keygen: () => number;
|
|
427
|
-
readonly cryptobox_get_pk: (a: number) => number;
|
|
428
|
-
readonly cryptobox_pk_to_u8vec: (a: number, b: number) => void;
|
|
429
|
-
readonly cryptobox_sk_to_u8vec: (a: number, b: number) => void;
|
|
430
|
-
readonly u8vec_to_cryptobox_pk: (a: number, b: number, c: number) => void;
|
|
431
|
-
readonly u8vec_to_cryptobox_sk: (a: number, b: number, c: number) => void;
|
|
432
|
-
readonly cryptobox_encrypt: (a: number, b: number, c: number, d: number) => number;
|
|
433
|
-
readonly cryptobox_decrypt: (a: number, b: number, c: number, d: number) => void;
|
|
434
|
-
readonly process_reencryption_resp_from_js: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
435
|
-
readonly process_reencryption_resp: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
436
413
|
readonly __wbg_requestid_free: (a: number, b: number) => void;
|
|
437
414
|
readonly __wbg_reencryptionrequestpayload_free: (a: number, b: number) => void;
|
|
438
415
|
readonly __wbg_get_reencryptionrequestpayload_version: (a: number) => number;
|
|
@@ -494,6 +471,29 @@ export interface InitOutput {
|
|
|
494
471
|
readonly __wbg_plaintext_free: (a: number, b: number) => void;
|
|
495
472
|
readonly __wbg_get_plaintext_bytes: (a: number, b: number) => void;
|
|
496
473
|
readonly __wbg_set_plaintext_bytes: (a: number, b: number, c: number) => void;
|
|
474
|
+
readonly __wbg_publicenckey_free: (a: number, b: number) => void;
|
|
475
|
+
readonly __wbg_privateenckey_free: (a: number, b: number) => void;
|
|
476
|
+
readonly __wbg_publicsigkey_free: (a: number, b: number) => void;
|
|
477
|
+
readonly __wbg_privatesigkey_free: (a: number, b: number) => void;
|
|
478
|
+
readonly public_sig_key_to_u8vec: (a: number, b: number) => void;
|
|
479
|
+
readonly u8vec_to_public_sig_key: (a: number, b: number, c: number) => void;
|
|
480
|
+
readonly private_sig_key_to_u8vec: (a: number, b: number) => void;
|
|
481
|
+
readonly u8vec_to_private_sig_key: (a: number, b: number, c: number) => void;
|
|
482
|
+
readonly new_client: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
483
|
+
readonly get_server_addrs: (a: number, b: number) => void;
|
|
484
|
+
readonly get_client_secret_key: (a: number) => number;
|
|
485
|
+
readonly get_client_address: (a: number, b: number) => void;
|
|
486
|
+
readonly __wbg_cryptoboxct_free: (a: number, b: number) => void;
|
|
487
|
+
readonly cryptobox_keygen: () => number;
|
|
488
|
+
readonly cryptobox_get_pk: (a: number) => number;
|
|
489
|
+
readonly cryptobox_pk_to_u8vec: (a: number, b: number) => void;
|
|
490
|
+
readonly cryptobox_sk_to_u8vec: (a: number, b: number) => void;
|
|
491
|
+
readonly u8vec_to_cryptobox_pk: (a: number, b: number, c: number) => void;
|
|
492
|
+
readonly u8vec_to_cryptobox_sk: (a: number, b: number, c: number) => void;
|
|
493
|
+
readonly cryptobox_encrypt: (a: number, b: number, c: number, d: number) => number;
|
|
494
|
+
readonly cryptobox_decrypt: (a: number, b: number, c: number, d: number) => void;
|
|
495
|
+
readonly process_reencryption_resp_from_js: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
496
|
+
readonly process_reencryption_resp: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
497
497
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
498
498
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
499
499
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
package/kms_lib.js
CHANGED
|
@@ -181,17 +181,24 @@ function debugString(val) {
|
|
|
181
181
|
return className;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
185
|
+
ptr = ptr >>> 0;
|
|
186
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
190
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
191
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
192
|
+
WASM_VECTOR_LEN = arg.length;
|
|
193
|
+
return ptr;
|
|
194
|
+
}
|
|
195
|
+
|
|
184
196
|
function _assertClass(instance, klass) {
|
|
185
197
|
if (!(instance instanceof klass)) {
|
|
186
198
|
throw new Error(`expected instance of ${klass.name}`);
|
|
187
199
|
}
|
|
188
200
|
return instance.ptr;
|
|
189
201
|
}
|
|
190
|
-
|
|
191
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
192
|
-
ptr = ptr >>> 0;
|
|
193
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
194
|
-
}
|
|
195
202
|
/**
|
|
196
203
|
* @param {PublicSigKey} pk
|
|
197
204
|
* @returns {Uint8Array}
|
|
@@ -211,12 +218,6 @@ export function public_sig_key_to_u8vec(pk) {
|
|
|
211
218
|
}
|
|
212
219
|
}
|
|
213
220
|
|
|
214
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
215
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
216
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
217
|
-
WASM_VECTOR_LEN = arg.length;
|
|
218
|
-
return ptr;
|
|
219
|
-
}
|
|
220
221
|
/**
|
|
221
222
|
* @param {Uint8Array} v
|
|
222
223
|
* @returns {PublicSigKey}
|
|
@@ -305,15 +306,15 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
305
306
|
*
|
|
306
307
|
* * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
|
|
307
308
|
* The "default" parameter choice is selected if no matching string is found.
|
|
308
|
-
* @param {(
|
|
309
|
+
* @param {(string)[]} server_addrs
|
|
309
310
|
* @param {string} client_address_hex
|
|
310
311
|
* @param {string} param_choice
|
|
311
312
|
* @returns {Client}
|
|
312
313
|
*/
|
|
313
|
-
export function new_client(
|
|
314
|
+
export function new_client(server_addrs, client_address_hex, param_choice) {
|
|
314
315
|
try {
|
|
315
316
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
316
|
-
const ptr0 = passArrayJsValueToWasm0(
|
|
317
|
+
const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
|
|
317
318
|
const len0 = WASM_VECTOR_LEN;
|
|
318
319
|
const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
319
320
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -343,13 +344,13 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
343
344
|
}
|
|
344
345
|
/**
|
|
345
346
|
* @param {Client} client
|
|
346
|
-
* @returns {(
|
|
347
|
+
* @returns {(string)[]}
|
|
347
348
|
*/
|
|
348
|
-
export function
|
|
349
|
+
export function get_server_addrs(client) {
|
|
349
350
|
try {
|
|
350
351
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
351
352
|
_assertClass(client, Client);
|
|
352
|
-
wasm.
|
|
353
|
+
wasm.get_server_addrs(retptr, client.__wbg_ptr);
|
|
353
354
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
354
355
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
355
356
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
@@ -1088,13 +1089,6 @@ export class PublicSigKey {
|
|
|
1088
1089
|
return obj;
|
|
1089
1090
|
}
|
|
1090
1091
|
|
|
1091
|
-
static __unwrap(jsValue) {
|
|
1092
|
-
if (!(jsValue instanceof PublicSigKey)) {
|
|
1093
|
-
return 0;
|
|
1094
|
-
}
|
|
1095
|
-
return jsValue.__destroy_into_raw();
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
1092
|
__destroy_into_raw() {
|
|
1099
1093
|
const ptr = this.__wbg_ptr;
|
|
1100
1094
|
this.__wbg_ptr = 0;
|
|
@@ -1763,9 +1757,9 @@ function __wbg_get_imports() {
|
|
|
1763
1757
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1764
1758
|
takeObject(arg0);
|
|
1765
1759
|
};
|
|
1766
|
-
imports.wbg.
|
|
1767
|
-
const ret =
|
|
1768
|
-
return
|
|
1760
|
+
imports.wbg.__wbg_reencryptionresponse_unwrap = function(arg0) {
|
|
1761
|
+
const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
|
|
1762
|
+
return ret;
|
|
1769
1763
|
};
|
|
1770
1764
|
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
1771
1765
|
const obj = getObject(arg1);
|
|
@@ -1773,14 +1767,6 @@ function __wbg_get_imports() {
|
|
|
1773
1767
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1774
1768
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1775
1769
|
};
|
|
1776
|
-
imports.wbg.__wbg_publicsigkey_unwrap = function(arg0) {
|
|
1777
|
-
const ret = PublicSigKey.__unwrap(takeObject(arg0));
|
|
1778
|
-
return ret;
|
|
1779
|
-
};
|
|
1780
|
-
imports.wbg.__wbg_reencryptionresponse_unwrap = function(arg0) {
|
|
1781
|
-
const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
|
|
1782
|
-
return ret;
|
|
1783
|
-
};
|
|
1784
1770
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
1785
1771
|
const obj = getObject(arg1);
|
|
1786
1772
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
package/kms_lib_bg.wasm
CHANGED
|
Binary file
|