node-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 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 {(PublicSigKey)[]} server_pks
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(server_pks: (PublicSigKey)[], client_address_hex: string, param_choice: string): 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 {(PublicSigKey)[]}
42
+ * @returns {(string)[]}
43
43
  */
44
- export function get_server_public_keys(client: Client): (PublicSigKey)[];
44
+ export function get_server_addrs(client: Client): (string)[];
45
45
  /**
46
46
  * @param {Client} client
47
47
  * @returns {PrivateSigKey | undefined}
package/kms_lib.js CHANGED
@@ -185,17 +185,24 @@ function debugString(val) {
185
185
  return className;
186
186
  }
187
187
 
188
+ function getArrayU8FromWasm0(ptr, len) {
189
+ ptr = ptr >>> 0;
190
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
191
+ }
192
+
193
+ function passArray8ToWasm0(arg, malloc) {
194
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
195
+ getUint8ArrayMemory0().set(arg, ptr / 1);
196
+ WASM_VECTOR_LEN = arg.length;
197
+ return ptr;
198
+ }
199
+
188
200
  function _assertClass(instance, klass) {
189
201
  if (!(instance instanceof klass)) {
190
202
  throw new Error(`expected instance of ${klass.name}`);
191
203
  }
192
204
  return instance.ptr;
193
205
  }
194
-
195
- function getArrayU8FromWasm0(ptr, len) {
196
- ptr = ptr >>> 0;
197
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
198
- }
199
206
  /**
200
207
  * @param {PublicSigKey} pk
201
208
  * @returns {Uint8Array}
@@ -215,12 +222,6 @@ module.exports.public_sig_key_to_u8vec = function(pk) {
215
222
  }
216
223
  };
217
224
 
218
- function passArray8ToWasm0(arg, malloc) {
219
- const ptr = malloc(arg.length * 1, 1) >>> 0;
220
- getUint8ArrayMemory0().set(arg, ptr / 1);
221
- WASM_VECTOR_LEN = arg.length;
222
- return ptr;
223
- }
224
225
  /**
225
226
  * @param {Uint8Array} v
226
227
  * @returns {PublicSigKey}
@@ -309,15 +310,15 @@ function passArrayJsValueToWasm0(array, malloc) {
309
310
  *
310
311
  * * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
311
312
  * The "default" parameter choice is selected if no matching string is found.
312
- * @param {(PublicSigKey)[]} server_pks
313
+ * @param {(string)[]} server_addrs
313
314
  * @param {string} client_address_hex
314
315
  * @param {string} param_choice
315
316
  * @returns {Client}
316
317
  */
317
- module.exports.new_client = function(server_pks, client_address_hex, param_choice) {
318
+ module.exports.new_client = function(server_addrs, client_address_hex, param_choice) {
318
319
  try {
319
320
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
320
- const ptr0 = passArrayJsValueToWasm0(server_pks, wasm.__wbindgen_malloc);
321
+ const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
321
322
  const len0 = WASM_VECTOR_LEN;
322
323
  const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
323
324
  const len1 = WASM_VECTOR_LEN;
@@ -347,13 +348,13 @@ function getArrayJsValueFromWasm0(ptr, len) {
347
348
  }
348
349
  /**
349
350
  * @param {Client} client
350
- * @returns {(PublicSigKey)[]}
351
+ * @returns {(string)[]}
351
352
  */
352
- module.exports.get_server_public_keys = function(client) {
353
+ module.exports.get_server_addrs = function(client) {
353
354
  try {
354
355
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
355
356
  _assertClass(client, Client);
356
- wasm.get_server_public_keys(retptr, client.__wbg_ptr);
357
+ wasm.get_server_addrs(retptr, client.__wbg_ptr);
357
358
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
358
359
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
359
360
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
@@ -1100,13 +1101,6 @@ class PublicSigKey {
1100
1101
  return obj;
1101
1102
  }
1102
1103
 
1103
- static __unwrap(jsValue) {
1104
- if (!(jsValue instanceof PublicSigKey)) {
1105
- return 0;
1106
- }
1107
- return jsValue.__destroy_into_raw();
1108
- }
1109
-
1110
1104
  __destroy_into_raw() {
1111
1105
  const ptr = this.__wbg_ptr;
1112
1106
  this.__wbg_ptr = 0;
@@ -1749,9 +1743,9 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
1749
1743
  takeObject(arg0);
1750
1744
  };
1751
1745
 
1752
- module.exports.__wbg_publicsigkey_new = function(arg0) {
1753
- const ret = PublicSigKey.__wrap(arg0);
1754
- return addHeapObject(ret);
1746
+ module.exports.__wbg_reencryptionresponse_unwrap = function(arg0) {
1747
+ const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
1748
+ return ret;
1755
1749
  };
1756
1750
 
1757
1751
  module.exports.__wbindgen_number_get = function(arg0, arg1) {
@@ -1761,16 +1755,6 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
1761
1755
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1762
1756
  };
1763
1757
 
1764
- module.exports.__wbg_publicsigkey_unwrap = function(arg0) {
1765
- const ret = PublicSigKey.__unwrap(takeObject(arg0));
1766
- return ret;
1767
- };
1768
-
1769
- module.exports.__wbg_reencryptionresponse_unwrap = function(arg0) {
1770
- const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
1771
- return ret;
1772
- };
1773
-
1774
1758
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
1775
1759
  const obj = getObject(arg1);
1776
1760
  const ret = typeof(obj) === 'string' ? obj : undefined;
package/kms_lib_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -3,7 +3,8 @@
3
3
  "collaborators": [
4
4
  "Zama"
5
5
  ],
6
- "version": "0.9.0-rc3",
6
+ "version": "0.9.0-rc5",
7
+ "license": "BSD-3-Clause-Clear",
7
8
  "files": [
8
9
  "kms_lib_bg.wasm",
9
10
  "kms_lib.js",