@wireapp/core-crypto 3.0.1 → 3.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -1,3 +1,13 @@
1
+ declare enum WirePolicy {
2
+ /**
3
+ * Handshake messages are never encrypted
4
+ */
5
+ Plaintext = 1,
6
+ /**
7
+ * Handshake messages are always encrypted
8
+ */
9
+ Ciphertext = 2
10
+ }
1
11
  declare enum Ciphersuite {
2
12
  /**
3
13
  * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
@@ -38,16 +48,6 @@ declare enum CredentialType {
38
48
  */
39
49
  X509 = 2
40
50
  }
41
- declare enum WirePolicy {
42
- /**
43
- * Handshake messages are never encrypted
44
- */
45
- Plaintext = 1,
46
- /**
47
- * Handshake messages are always encrypted
48
- */
49
- Ciphertext = 2
50
- }
51
51
  /**
52
52
  * For creating a challenge.
53
53
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
@@ -13,14 +13,6 @@ var takeObject = function(idx) {
13
13
  dropObject(idx);
14
14
  return ret;
15
15
  };
16
- var addHeapObject = function(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
16
  var getUint8ArrayMemory0 = function() {
25
17
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
26
18
  cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
@@ -31,6 +23,14 @@ var getStringFromWasm0 = function(ptr, len) {
31
23
  ptr = ptr >>> 0;
32
24
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
33
25
  };
26
+ var addHeapObject = function(obj) {
27
+ if (heap_next === heap.length)
28
+ heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+ heap[idx] = obj;
32
+ return idx;
33
+ };
34
34
  var passStringToWasm0 = function(arg, malloc, realloc) {
35
35
  if (realloc === undefined) {
36
36
  const buf = cachedTextEncoder.encode(arg);
@@ -152,13 +152,13 @@ var makeMutClosure = function(arg0, arg1, dtor, f) {
152
152
  return real;
153
153
  };
154
154
  var __wbg_adapter_54 = function(arg0, arg1, arg2) {
155
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0c1be8861dcd34d1(arg0, arg1, addHeapObject(arg2));
155
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hff2684683db17a09(arg0, arg1, addHeapObject(arg2));
156
156
  };
157
157
  var __wbg_adapter_57 = function(arg0, arg1, arg2) {
158
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h70b4112dc7fedf66(arg0, arg1, addHeapObject(arg2));
158
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52e586377d5b26c8(arg0, arg1, addHeapObject(arg2));
159
159
  };
160
160
  var __wbg_adapter_60 = function(arg0, arg1, arg2) {
161
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h08f9b866173405ab(arg0, arg1, addHeapObject(arg2));
161
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3476f7c9293a904a(arg0, arg1, addHeapObject(arg2));
162
162
  };
163
163
  var getArrayJsValueFromWasm0 = function(ptr, len) {
164
164
  ptr = ptr >>> 0;
@@ -210,7 +210,7 @@ var handleError = function(f, args) {
210
210
  }
211
211
  };
212
212
  var __wbg_adapter_512 = function(arg0, arg1, arg2, arg3) {
213
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h5175575964179a00(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
213
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h76d6b1db634d2144(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
214
214
  };
215
215
  async function __wbg_load(module, imports) {
216
216
  if (typeof Response === "function" && module instanceof Response) {
@@ -242,20 +242,28 @@ var __wbg_get_imports = function() {
242
242
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
243
243
  takeObject(arg0);
244
244
  };
245
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
246
+ const ret = getStringFromWasm0(arg0, arg1);
247
+ return addHeapObject(ret);
248
+ };
245
249
  imports.wbg.__wbindgen_number_new = function(arg0) {
246
250
  const ret = arg0;
247
251
  return addHeapObject(ret);
248
252
  };
253
+ imports.wbg.__wbg_acmedirectory_new = function(arg0) {
254
+ const ret = AcmeDirectory.__wrap(arg0);
255
+ return addHeapObject(ret);
256
+ };
249
257
  imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
250
258
  const ret = FfiWireE2EIdentity.__wrap(arg0);
251
259
  return addHeapObject(ret);
252
260
  };
253
- imports.wbg.__wbg_acmedirectory_new = function(arg0) {
254
- const ret = AcmeDirectory.__wrap(arg0);
261
+ imports.wbg.__wbg_newacmeorder_new = function(arg0) {
262
+ const ret = NewAcmeOrder.__wrap(arg0);
255
263
  return addHeapObject(ret);
256
264
  };
257
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
258
- const ret = getStringFromWasm0(arg0, arg1);
265
+ imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
266
+ const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
259
267
  return addHeapObject(ret);
260
268
  };
261
269
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
@@ -266,34 +274,26 @@ var __wbg_get_imports = function() {
266
274
  const ret = NewAcmeAuthz.__wrap(arg0);
267
275
  return addHeapObject(ret);
268
276
  };
269
- imports.wbg.__wbg_execute_9fba33bf55bf1adb = function() {
277
+ imports.wbg.__wbg_execute_c087a9ab7c74a93b = function() {
270
278
  return handleError(function(arg0, arg1) {
271
279
  const ret = getObject(arg0).execute(CoreCryptoContext.__wrap(arg1));
272
280
  return addHeapObject(ret);
273
281
  }, arguments);
274
282
  };
275
- imports.wbg.__wbg_newacmeorder_new = function(arg0) {
276
- const ret = NewAcmeOrder.__wrap(arg0);
277
- return addHeapObject(ret);
278
- };
279
- imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
280
- const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
281
- return addHeapObject(ret);
282
- };
283
283
  imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
284
284
  const ret = BufferedDecryptedMessage.__wrap(arg0);
285
285
  return addHeapObject(ret);
286
286
  };
287
- imports.wbg.__wbg_proposalbundle_new = function(arg0) {
288
- const ret = ProposalBundle.__wrap(arg0);
287
+ imports.wbg.__wbg_commitbundle_new = function(arg0) {
288
+ const ret = CommitBundle.__wrap(arg0);
289
289
  return addHeapObject(ret);
290
290
  };
291
291
  imports.wbg.__wbg_corecrypto_new = function(arg0) {
292
292
  const ret = CoreCrypto.__wrap(arg0);
293
293
  return addHeapObject(ret);
294
294
  };
295
- imports.wbg.__wbg_commitbundle_new = function(arg0) {
296
- const ret = CommitBundle.__wrap(arg0);
295
+ imports.wbg.__wbg_proposalbundle_new = function(arg0) {
296
+ const ret = ProposalBundle.__wrap(arg0);
297
297
  return addHeapObject(ret);
298
298
  };
299
299
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
@@ -1049,16 +1049,16 @@ var __wbg_get_imports = function() {
1049
1049
  const ret = v0;
1050
1050
  return addHeapObject(ret);
1051
1051
  };
1052
- imports.wbg.__wbindgen_closure_wrapper3731 = function(arg0, arg1, arg2) {
1053
- const ret = makeMutClosure(arg0, arg1, 899, __wbg_adapter_54);
1052
+ imports.wbg.__wbindgen_closure_wrapper3747 = function(arg0, arg1, arg2) {
1053
+ const ret = makeMutClosure(arg0, arg1, 901, __wbg_adapter_54);
1054
1054
  return addHeapObject(ret);
1055
1055
  };
1056
- imports.wbg.__wbindgen_closure_wrapper13475 = function(arg0, arg1, arg2) {
1057
- const ret = makeMutClosure(arg0, arg1, 2172, __wbg_adapter_57);
1056
+ imports.wbg.__wbindgen_closure_wrapper13485 = function(arg0, arg1, arg2) {
1057
+ const ret = makeMutClosure(arg0, arg1, 2175, __wbg_adapter_57);
1058
1058
  return addHeapObject(ret);
1059
1059
  };
1060
- imports.wbg.__wbindgen_closure_wrapper15455 = function(arg0, arg1, arg2) {
1061
- const ret = makeMutClosure(arg0, arg1, 2399, __wbg_adapter_60);
1060
+ imports.wbg.__wbindgen_closure_wrapper15495 = function(arg0, arg1, arg2) {
1061
+ const ret = makeMutClosure(arg0, arg1, 2410, __wbg_adapter_60);
1062
1062
  return addHeapObject(ret);
1063
1063
  };
1064
1064
  return imports;
@@ -1123,6 +1123,12 @@ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: ()
1123
1123
  wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b);
1124
1124
  });
1125
1125
  var cachedUint16ArrayMemory0 = null;
1126
+ var WirePolicy = Object.freeze({
1127
+ Plaintext: 1,
1128
+ "1": "Plaintext",
1129
+ Ciphertext: 2,
1130
+ "2": "Ciphertext"
1131
+ });
1126
1132
  var Ciphersuite = Object.freeze({
1127
1133
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1128
1134
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1139,6 +1145,7 @@ var Ciphersuite = Object.freeze({
1139
1145
  MLS_256_DHKEMP384_AES256GCM_SHA384_P384: 7,
1140
1146
  "7": "MLS_256_DHKEMP384_AES256GCM_SHA384_P384"
1141
1147
  });
1148
+ 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" });
1142
1149
  var DeviceStatus = Object.freeze({
1143
1150
  Valid: 1,
1144
1151
  "1": "Valid",
@@ -1153,13 +1160,6 @@ var CredentialType = Object.freeze({
1153
1160
  X509: 2,
1154
1161
  "2": "X509"
1155
1162
  });
1156
- 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" });
1157
- var WirePolicy = Object.freeze({
1158
- Plaintext: 1,
1159
- "1": "Plaintext",
1160
- Ciphertext: 2,
1161
- "2": "Ciphertext"
1162
- });
1163
1163
  var AcmeChallengeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
1164
1164
  }, unregister: () => {
1165
1165
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_acmechallenge_free(ptr >>> 0, 1));
@@ -3500,6 +3500,9 @@ class CoreCryptoError extends Error {
3500
3500
  }
3501
3501
  }
3502
3502
  static fromStdError(e) {
3503
+ if (e instanceof CoreCryptoError) {
3504
+ return e;
3505
+ }
3503
3506
  const opts = {
3504
3507
  cause: e.cause || undefined,
3505
3508
  stack: e.stack || undefined