@wireapp/core-crypto 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -175,6 +175,7 @@ cargo bench --bench=commit -- --quick
175
175
  ```
176
176
  where `commit` is the name of the bench specified in [`crypto/Cargo.toml`](crypto/Cargo.toml), and the corresponding file in [`crypto/benches`](crypto/benches/).
177
177
  In case you're interested in higher accuracy, and willing to trade it for execution speed, omit the `--quick` flag.
178
+ If you need reporting plots, remove the `.without_plots()` call in [`crypto/benches/utils/mod.rs`](crypto/benches/utils/mod.rs).
178
179
  The reports generated by criterion will be located in `target/criterion`.
179
180
 
180
181
  ## Git workflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -1,37 +1,37 @@
1
1
  // bindings/js/wasm/core-crypto-ffi.js
2
- var addHeapObject = function(obj) {
3
- if (heap_next === heap.length)
4
- heap.push(heap.length + 1);
5
- const idx = heap_next;
6
- heap_next = heap[idx];
7
- heap[idx] = obj;
8
- return idx;
9
- };
10
- var getObject = function(idx) {
2
+ function getObject(idx) {
11
3
  return heap[idx];
12
- };
13
- var dropObject = function(idx) {
4
+ }
5
+ function dropObject(idx) {
14
6
  if (idx < 132)
15
7
  return;
16
8
  heap[idx] = heap_next;
17
9
  heap_next = idx;
18
- };
19
- var takeObject = function(idx) {
10
+ }
11
+ function takeObject(idx) {
20
12
  const ret = getObject(idx);
21
13
  dropObject(idx);
22
14
  return ret;
23
- };
24
- var getUint8Memory0 = function() {
15
+ }
16
+ function addHeapObject(obj) {
17
+ if (heap_next === heap.length)
18
+ heap.push(heap.length + 1);
19
+ const idx = heap_next;
20
+ heap_next = heap[idx];
21
+ heap[idx] = obj;
22
+ return idx;
23
+ }
24
+ function getUint8Memory0() {
25
25
  if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
26
26
  cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
27
27
  }
28
28
  return cachedUint8Memory0;
29
- };
30
- var getStringFromWasm0 = function(ptr, len) {
29
+ }
30
+ function getStringFromWasm0(ptr, len) {
31
31
  ptr = ptr >>> 0;
32
32
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
33
- };
34
- var passStringToWasm0 = function(arg, malloc, realloc) {
33
+ }
34
+ function passStringToWasm0(arg, malloc, realloc) {
35
35
  if (realloc === undefined) {
36
36
  const buf = cachedTextEncoder.encode(arg);
37
37
  const ptr2 = malloc(buf.length, 1) >>> 0;
@@ -61,29 +61,29 @@ var passStringToWasm0 = function(arg, malloc, realloc) {
61
61
  }
62
62
  WASM_VECTOR_LEN = offset;
63
63
  return ptr;
64
- };
65
- var isLikeNone = function(x) {
64
+ }
65
+ function isLikeNone(x) {
66
66
  return x === undefined || x === null;
67
- };
68
- var getInt32Memory0 = function() {
67
+ }
68
+ function getInt32Memory0() {
69
69
  if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
70
70
  cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
71
71
  }
72
72
  return cachedInt32Memory0;
73
- };
74
- var getFloat64Memory0 = function() {
73
+ }
74
+ function getFloat64Memory0() {
75
75
  if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
76
76
  cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
77
77
  }
78
78
  return cachedFloat64Memory0;
79
- };
80
- var getBigInt64Memory0 = function() {
79
+ }
80
+ function getBigInt64Memory0() {
81
81
  if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
82
82
  cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
83
83
  }
84
84
  return cachedBigInt64Memory0;
85
- };
86
- var debugString = function(val) {
85
+ }
86
+ function debugString(val) {
87
87
  const type = typeof val;
88
88
  if (type == "number" || type == "boolean" || val == null) {
89
89
  return `${val}`;
@@ -137,8 +137,8 @@ var debugString = function(val) {
137
137
  return `${val.name}: ${val.message}\n${val.stack}`;
138
138
  }
139
139
  return className;
140
- };
141
- var makeMutClosure = function(arg0, arg1, dtor, f) {
140
+ }
141
+ function makeMutClosure(arg0, arg1, dtor, f) {
142
142
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
143
143
  const real = (...args) => {
144
144
  state.cnt++;
@@ -158,27 +158,27 @@ var makeMutClosure = function(arg0, arg1, dtor, f) {
158
158
  real.original = state;
159
159
  CLOSURE_DTORS.register(real, state, state);
160
160
  return real;
161
- };
162
- var __wbg_adapter_52 = function(arg0, arg1, arg2) {
163
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h88f2899e579ac04e(arg0, arg1, addHeapObject(arg2));
164
- };
165
- var __wbg_adapter_55 = function(arg0, arg1, arg2) {
166
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h659e5e831d2685da(arg0, arg1, addHeapObject(arg2));
167
- };
168
- var __wbg_adapter_58 = function(arg0, arg1, arg2) {
169
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h16c310ab96d10e9a(arg0, arg1, addHeapObject(arg2));
170
- };
171
- var getArrayU8FromWasm0 = function(ptr, len) {
161
+ }
162
+ function __wbg_adapter_52(arg0, arg1, arg2) {
163
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6c76075ec01f61f1(arg0, arg1, addHeapObject(arg2));
164
+ }
165
+ function __wbg_adapter_55(arg0, arg1, arg2) {
166
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h31cbea7dd3499265(arg0, arg1, addHeapObject(arg2));
167
+ }
168
+ function __wbg_adapter_58(arg0, arg1, arg2) {
169
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7310902af9a81ff6(arg0, arg1, addHeapObject(arg2));
170
+ }
171
+ function getArrayU8FromWasm0(ptr, len) {
172
172
  ptr = ptr >>> 0;
173
173
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
174
- };
175
- var getUint32Memory0 = function() {
174
+ }
175
+ function getUint32Memory0() {
176
176
  if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
177
177
  cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
178
178
  }
179
179
  return cachedUint32Memory0;
180
- };
181
- var getArrayJsValueFromWasm0 = function(ptr, len) {
180
+ }
181
+ function getArrayJsValueFromWasm0(ptr, len) {
182
182
  ptr = ptr >>> 0;
183
183
  const mem = getUint32Memory0();
184
184
  const slice = mem.subarray(ptr / 4, ptr / 4 + len);
@@ -187,20 +187,20 @@ var getArrayJsValueFromWasm0 = function(ptr, len) {
187
187
  result.push(takeObject(slice[i]));
188
188
  }
189
189
  return result;
190
- };
191
- var passArray8ToWasm0 = function(arg, malloc) {
190
+ }
191
+ function passArray8ToWasm0(arg, malloc) {
192
192
  const ptr = malloc(arg.length * 1, 1) >>> 0;
193
193
  getUint8Memory0().set(arg, ptr / 1);
194
194
  WASM_VECTOR_LEN = arg.length;
195
195
  return ptr;
196
- };
197
- var _assertClass = function(instance, klass) {
196
+ }
197
+ function _assertClass(instance, klass) {
198
198
  if (!(instance instanceof klass)) {
199
199
  throw new Error(`expected instance of ${klass.name}`);
200
200
  }
201
201
  return instance.ptr;
202
- };
203
- var passArrayJsValueToWasm0 = function(array, malloc) {
202
+ }
203
+ function passArrayJsValueToWasm0(array, malloc) {
204
204
  const ptr = malloc(array.length * 4, 4) >>> 0;
205
205
  const mem = getUint32Memory0();
206
206
  for (let i = 0;i < array.length; i++) {
@@ -208,29 +208,29 @@ var passArrayJsValueToWasm0 = function(array, malloc) {
208
208
  }
209
209
  WASM_VECTOR_LEN = array.length;
210
210
  return ptr;
211
- };
212
- var getUint16Memory0 = function() {
211
+ }
212
+ function getUint16Memory0() {
213
213
  if (cachedUint16Memory0 === null || cachedUint16Memory0.byteLength === 0) {
214
214
  cachedUint16Memory0 = new Uint16Array(wasm.memory.buffer);
215
215
  }
216
216
  return cachedUint16Memory0;
217
- };
218
- var passArray16ToWasm0 = function(arg, malloc) {
217
+ }
218
+ function passArray16ToWasm0(arg, malloc) {
219
219
  const ptr = malloc(arg.length * 2, 2) >>> 0;
220
220
  getUint16Memory0().set(arg, ptr / 2);
221
221
  WASM_VECTOR_LEN = arg.length;
222
222
  return ptr;
223
- };
224
- var handleError = function(f, args) {
223
+ }
224
+ function handleError(f, args) {
225
225
  try {
226
226
  return f.apply(this, args);
227
227
  } catch (e) {
228
228
  wasm.__wbindgen_exn_store(addHeapObject(e));
229
229
  }
230
- };
231
- var __wbg_adapter_440 = function(arg0, arg1, arg2, arg3) {
232
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h2d8bdc0ace0dcd4e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
233
- };
230
+ }
231
+ function __wbg_adapter_440(arg0, arg1, arg2, arg3) {
232
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h0528ed225d844bb6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
233
+ }
234
234
  async function __wbg_load(module, imports) {
235
235
  if (typeof Response === "function" && module instanceof Response) {
236
236
  if (typeof WebAssembly.instantiateStreaming === "function") {
@@ -255,62 +255,62 @@ async function __wbg_load(module, imports) {
255
255
  }
256
256
  }
257
257
  }
258
- var __wbg_get_imports = function() {
258
+ function __wbg_get_imports() {
259
259
  const imports = {};
260
260
  imports.wbg = {};
261
- imports.wbg.__wbindgen_number_new = function(arg0) {
262
- const ret = arg0;
263
- return addHeapObject(ret);
264
- };
265
- imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
266
- const ret = BufferedDecryptedMessage.__wrap(arg0);
267
- return addHeapObject(ret);
268
- };
269
261
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
270
262
  takeObject(arg0);
271
263
  };
264
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
265
+ const ret = getObject(arg0);
266
+ return addHeapObject(ret);
267
+ };
272
268
  imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
273
269
  const ret = FfiWireE2EIdentity.__wrap(arg0);
274
270
  return addHeapObject(ret);
275
271
  };
272
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
273
+ const ret = getStringFromWasm0(arg0, arg1);
274
+ return addHeapObject(ret);
275
+ };
276
+ imports.wbg.__wbindgen_number_new = function(arg0) {
277
+ const ret = arg0;
278
+ return addHeapObject(ret);
279
+ };
280
+ imports.wbg.__wbg_acmedirectory_new = function(arg0) {
281
+ const ret = AcmeDirectory.__wrap(arg0);
282
+ return addHeapObject(ret);
283
+ };
276
284
  imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
277
285
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
278
286
  return addHeapObject(ret);
279
287
  };
280
- imports.wbg.__wbg_corecrypto_new = function(arg0) {
281
- const ret = CoreCrypto.__wrap(arg0);
288
+ imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
289
+ const ret = NewAcmeAuthz.__wrap(arg0);
282
290
  return addHeapObject(ret);
283
291
  };
284
292
  imports.wbg.__wbg_newacmeorder_new = function(arg0) {
285
293
  const ret = NewAcmeOrder.__wrap(arg0);
286
294
  return addHeapObject(ret);
287
295
  };
288
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
289
- const ret = getObject(arg0);
296
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
297
+ const ret = BigInt.asUintN(64, arg0);
290
298
  return addHeapObject(ret);
291
299
  };
292
- imports.wbg.__wbg_commitbundle_new = function(arg0) {
293
- const ret = CommitBundle.__wrap(arg0);
300
+ imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
301
+ const ret = BufferedDecryptedMessage.__wrap(arg0);
294
302
  return addHeapObject(ret);
295
303
  };
296
304
  imports.wbg.__wbg_proposalbundle_new = function(arg0) {
297
305
  const ret = ProposalBundle.__wrap(arg0);
298
306
  return addHeapObject(ret);
299
307
  };
300
- imports.wbg.__wbg_acmedirectory_new = function(arg0) {
301
- const ret = AcmeDirectory.__wrap(arg0);
302
- return addHeapObject(ret);
303
- };
304
- imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
305
- const ret = NewAcmeAuthz.__wrap(arg0);
306
- return addHeapObject(ret);
307
- };
308
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
309
- const ret = getStringFromWasm0(arg0, arg1);
308
+ imports.wbg.__wbg_corecrypto_new = function(arg0) {
309
+ const ret = CoreCrypto.__wrap(arg0);
310
310
  return addHeapObject(ret);
311
311
  };
312
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
313
- const ret = BigInt.asUintN(64, arg0);
312
+ imports.wbg.__wbg_commitbundle_new = function(arg0) {
313
+ const ret = CommitBundle.__wrap(arg0);
314
314
  return addHeapObject(ret);
315
315
  };
316
316
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -996,23 +996,23 @@ var __wbg_get_imports = function() {
996
996
  const ret = wasm.memory;
997
997
  return addHeapObject(ret);
998
998
  };
999
- imports.wbg.__wbindgen_closure_wrapper3098 = function(arg0, arg1, arg2) {
1000
- const ret = makeMutClosure(arg0, arg1, 636, __wbg_adapter_52);
999
+ imports.wbg.__wbindgen_closure_wrapper3102 = function(arg0, arg1, arg2) {
1000
+ const ret = makeMutClosure(arg0, arg1, 632, __wbg_adapter_52);
1001
1001
  return addHeapObject(ret);
1002
1002
  };
1003
- imports.wbg.__wbindgen_closure_wrapper13436 = function(arg0, arg1, arg2) {
1004
- const ret = makeMutClosure(arg0, arg1, 2121, __wbg_adapter_55);
1003
+ imports.wbg.__wbindgen_closure_wrapper13414 = function(arg0, arg1, arg2) {
1004
+ const ret = makeMutClosure(arg0, arg1, 2032, __wbg_adapter_55);
1005
1005
  return addHeapObject(ret);
1006
1006
  };
1007
- imports.wbg.__wbindgen_closure_wrapper15163 = function(arg0, arg1, arg2) {
1008
- const ret = makeMutClosure(arg0, arg1, 2366, __wbg_adapter_58);
1007
+ imports.wbg.__wbindgen_closure_wrapper15127 = function(arg0, arg1, arg2) {
1008
+ const ret = makeMutClosure(arg0, arg1, 2247, __wbg_adapter_58);
1009
1009
  return addHeapObject(ret);
1010
1010
  };
1011
1011
  return imports;
1012
- };
1013
- var __wbg_init_memory = function(imports, maybe_memory) {
1014
- };
1015
- var __wbg_finalize_init = function(instance, module) {
1012
+ }
1013
+ function __wbg_init_memory(imports, maybe_memory) {
1014
+ }
1015
+ function __wbg_finalize_init(instance, module) {
1016
1016
  wasm = instance.exports;
1017
1017
  __wbg_init.__wbindgen_wasm_module = module;
1018
1018
  cachedBigInt64Memory0 = null;
@@ -1022,7 +1022,7 @@ var __wbg_finalize_init = function(instance, module) {
1022
1022
  cachedUint32Memory0 = null;
1023
1023
  cachedUint8Memory0 = null;
1024
1024
  return wasm;
1025
- };
1025
+ }
1026
1026
  async function __wbg_init(input) {
1027
1027
  if (wasm !== undefined)
1028
1028
  return wasm;
@@ -1072,6 +1072,15 @@ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: ()
1072
1072
  });
1073
1073
  var cachedUint32Memory0 = null;
1074
1074
  var cachedUint16Memory0 = null;
1075
+ var DeviceStatus = Object.freeze({
1076
+ Valid: 1,
1077
+ "1": "Valid",
1078
+ Expired: 2,
1079
+ "2": "Expired",
1080
+ Revoked: 3,
1081
+ "3": "Revoked"
1082
+ });
1083
+ var CoreCryptoLogLevel = Object.freeze({ Off: 1, "1": "Off", Trace: 2, "2": "Trace", Debug: 3, "3": "Debug", Info: 4, "4": "Info", Warn: 5, "5": "Warn", Error: 6, "6": "Error" });
1075
1084
  var Ciphersuite = Object.freeze({
1076
1085
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1077
1086
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1088,26 +1097,17 @@ var Ciphersuite = Object.freeze({
1088
1097
  MLS_256_DHKEMP384_AES256GCM_SHA384_P384: 7,
1089
1098
  "7": "MLS_256_DHKEMP384_AES256GCM_SHA384_P384"
1090
1099
  });
1091
- var CredentialType = Object.freeze({
1092
- Basic: 1,
1093
- "1": "Basic",
1094
- X509: 2,
1095
- "2": "X509"
1096
- });
1097
- var CoreCryptoLogLevel = Object.freeze({ Off: 1, "1": "Off", Trace: 2, "2": "Trace", Debug: 3, "3": "Debug", Info: 4, "4": "Info", Warn: 5, "5": "Warn", Error: 6, "6": "Error" });
1098
1100
  var WirePolicy = Object.freeze({
1099
1101
  Plaintext: 1,
1100
1102
  "1": "Plaintext",
1101
1103
  Ciphertext: 2,
1102
1104
  "2": "Ciphertext"
1103
1105
  });
1104
- var DeviceStatus = Object.freeze({
1105
- Valid: 1,
1106
- "1": "Valid",
1107
- Expired: 2,
1108
- "2": "Expired",
1109
- Revoked: 3,
1110
- "3": "Revoked"
1106
+ var CredentialType = Object.freeze({
1107
+ Basic: 1,
1108
+ "1": "Basic",
1109
+ X509: 2,
1110
+ "2": "X509"
1111
1111
  });
1112
1112
  var AcmeChallengeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1113
1113
  }, unregister: () => {
@@ -2635,11 +2635,11 @@ class X509Identity {
2635
2635
  var core_crypto_ffi_default = __wbg_init;
2636
2636
 
2637
2637
  // bindings/js/CoreCrypto.ts
2638
- var normalizeEnum = function(enumType, value) {
2638
+ function normalizeEnum(enumType, value) {
2639
2639
  const enumAsString = enumType[value];
2640
2640
  const enumAsDiscriminant = enumType[enumAsString];
2641
2641
  return enumAsDiscriminant;
2642
- };
2642
+ }
2643
2643
  function initLogger(logger, level, ctx = null) {
2644
2644
  const wasmLogger = new CoreCryptoWasmLogger(logger.log, ctx);
2645
2645
  undefined(wasmLogger, normalizeEnum(CoreCryptoLogLevel2, level));