@wireapp/core-crypto 1.0.0-rc.22 → 1.0.0-rc.23

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.23",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -1,5 +1,3 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
1
  /**
4
2
  * see [core_crypto::prelude::DeviceStatus]
5
3
  */
@@ -209,24 +207,6 @@ export interface ConversationConfiguration {
209
207
  * Implementation specific configuration
210
208
  */
211
209
  custom?: CustomConfiguration;
212
- /**
213
- * Trust anchors to be added in the group's context extensions
214
- */
215
- perDomainTrustAnchors?: PerDomainTrustAnchor[];
216
- }
217
- /**
218
- * A wrapper containing the configuration for trust anchors to be added in the group's context
219
- * extensions
220
- */
221
- export interface PerDomainTrustAnchor {
222
- /**
223
- * Domain name of the owning backend this anchor refers to. One of the certificate in the chain has to have this domain in its SANs
224
- */
225
- domain_name: string;
226
- /**
227
- * PEM encoded (partial) certificate chain. This contains the certificate chain for the CA certificate issuing the E2E Identity certificates
228
- */
229
- intermediate_certificate_chain: string;
230
210
  }
231
211
  /**
232
212
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -857,22 +837,6 @@ export declare class CoreCrypto {
857
837
  * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
858
838
  */
859
839
  encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
860
- /**
861
- * Updates the trust anchors for a conversation. This should be called when a federated event happens (new team added/removed).
862
- * Clients should add and/or remove trust anchors from the new backend to the conversation. The method will check
863
- * for duplicated domains and the validity of the certificate chain.
864
- *
865
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
866
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
867
- * epoch, use new encryption secrets etc...
868
- *
869
- * @param conversationId - The ID of the conversation
870
- * @param removeDomainNames - Domains to remove from the trust anchors
871
- * @param addTrustAnchors - New trust anchors to add to the conversation
872
- *
873
- * @returns A {@link CommitBundle}
874
- */
875
- updateTrustAnchorsFromConversation(conversationId: ConversationId, removeDomainNames: string[], addTrustAnchors: PerDomainTrustAnchor[]): Promise<CommitBundle>;
876
840
  /**
877
841
  * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
878
842
  *
@@ -157,12 +157,12 @@ var makeMutClosure = function(arg0, arg1, dtor, f) {
157
157
  return real;
158
158
  };
159
159
  var __wbg_adapter_54 = function(arg0, arg1, arg2) {
160
- wasm.wasm_bindgen__convert__closures__invoke1_mut__hee2344b2c4dec822(arg0, arg1, addHeapObject(arg2));
160
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h888c0d3abee5ff69(arg0, arg1, addHeapObject(arg2));
161
161
  };
162
162
  var __wbg_adapter_57 = function(arg0, arg1, arg2) {
163
163
  try {
164
164
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
165
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h0822694acdee5799(retptr, arg0, arg1, addHeapObject(arg2));
165
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h53020c39e721a2fe(retptr, arg0, arg1, addHeapObject(arg2));
166
166
  var r0 = getInt32Memory0()[retptr / 4 + 0];
167
167
  var r1 = getInt32Memory0()[retptr / 4 + 1];
168
168
  if (r1) {
@@ -232,8 +232,8 @@ var handleError = function(f, args) {
232
232
  wasm.__wbindgen_exn_store(addHeapObject(e));
233
233
  }
234
234
  };
235
- var __wbg_adapter_406 = function(arg0, arg1, arg2, arg3) {
236
- wasm.wasm_bindgen__convert__closures__invoke2_mut__hb07ea52845d244dd(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
235
+ var __wbg_adapter_404 = function(arg0, arg1, arg2, arg3) {
236
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h22a323e275c3b23f(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
237
237
  };
238
238
  async function __wbg_load(module, imports) {
239
239
  if (typeof Response === "function" && module instanceof Response) {
@@ -262,20 +262,31 @@ async function __wbg_load(module, imports) {
262
262
  var __wbg_get_imports = function() {
263
263
  const imports = {};
264
264
  imports.wbg = {};
265
- imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
266
- const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
265
+ imports.wbg.__wbg_corecrypto_new = function(arg0) {
266
+ const ret = CoreCrypto.__wrap(arg0);
267
+ return addHeapObject(ret);
268
+ };
269
+ imports.wbg.__wbindgen_number_new = function(arg0) {
270
+ const ret = arg0;
271
+ return addHeapObject(ret);
272
+ };
273
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
274
+ takeObject(arg0);
275
+ };
276
+ imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
277
+ const ret = NewAcmeAuthz.__wrap(arg0);
267
278
  return addHeapObject(ret);
268
279
  };
269
280
  imports.wbg.__wbg_acmedirectory_new = function(arg0) {
270
281
  const ret = AcmeDirectory.__wrap(arg0);
271
282
  return addHeapObject(ret);
272
283
  };
273
- imports.wbg.__wbg_proposalbundle_new = function(arg0) {
274
- const ret = ProposalBundle.__wrap(arg0);
284
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
285
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
275
286
  return addHeapObject(ret);
276
287
  };
277
- imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
278
- const ret = NewAcmeAuthz.__wrap(arg0);
288
+ imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
289
+ const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
279
290
  return addHeapObject(ret);
280
291
  };
281
292
  imports.wbg.__wbg_commitbundle_new = function(arg0) {
@@ -286,40 +297,33 @@ var __wbg_get_imports = function() {
286
297
  const ret = NewAcmeOrder.__wrap(arg0);
287
298
  return addHeapObject(ret);
288
299
  };
289
- imports.wbg.__wbindgen_number_new = function(arg0) {
290
- const ret = arg0;
291
- return addHeapObject(ret);
292
- };
293
300
  imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
294
301
  const ret = BufferedDecryptedMessage.__wrap(arg0);
295
302
  return addHeapObject(ret);
296
303
  };
297
- imports.wbg.__wbg_corecrypto_new = function(arg0) {
298
- const ret = CoreCrypto.__wrap(arg0);
299
- return addHeapObject(ret);
300
- };
301
- imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
302
- const ret = FfiWireE2EIdentity.__wrap(arg0);
304
+ imports.wbg.__wbg_proposalbundle_new = function(arg0) {
305
+ const ret = ProposalBundle.__wrap(arg0);
303
306
  return addHeapObject(ret);
304
307
  };
305
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
306
- takeObject(arg0);
307
- };
308
308
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
309
309
  const ret = getObject(arg0);
310
310
  return addHeapObject(ret);
311
311
  };
312
- imports.wbg.__wbindgen_is_null = function(arg0) {
313
- const ret = getObject(arg0) === null;
314
- return ret;
312
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
313
+ const ret = BigInt.asUintN(64, arg0);
314
+ return addHeapObject(ret);
315
315
  };
316
316
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
317
317
  const ret = getStringFromWasm0(arg0, arg1);
318
318
  return addHeapObject(ret);
319
319
  };
320
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
321
- const ret = BigInt.asUintN(64, arg0);
322
- return addHeapObject(ret);
320
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
321
+ const ret = getObject(arg0) === undefined;
322
+ return ret;
323
+ };
324
+ imports.wbg.__wbindgen_is_null = function(arg0) {
325
+ const ret = getObject(arg0) === null;
326
+ return ret;
323
327
  };
324
328
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
325
329
  const obj = getObject(arg1);
@@ -329,14 +333,6 @@ var __wbg_get_imports = function() {
329
333
  getInt32Memory0()[arg0 / 4 + 1] = len1;
330
334
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
331
335
  };
332
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
333
- const ret = getObject(arg0) === undefined;
334
- return ret;
335
- };
336
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
337
- const ret = getObject(arg0) in getObject(arg1);
338
- return ret;
339
- };
340
336
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
341
337
  const v = getObject(arg0);
342
338
  const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
@@ -365,6 +361,10 @@ var __wbg_get_imports = function() {
365
361
  const ret = typeof val === "object" && val !== null;
366
362
  return ret;
367
363
  };
364
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
365
+ const ret = getObject(arg0) in getObject(arg1);
366
+ return ret;
367
+ };
368
368
  imports.wbg.__wbg_queueMicrotask_adae4bc085237231 = function(arg0) {
369
369
  const ret = getObject(arg0).queueMicrotask;
370
370
  return addHeapObject(ret);
@@ -886,7 +886,7 @@ var __wbg_get_imports = function() {
886
886
  const a = state0.a;
887
887
  state0.a = 0;
888
888
  try {
889
- return __wbg_adapter_406(a, state0.b, arg02, arg12);
889
+ return __wbg_adapter_404(a, state0.b, arg02, arg12);
890
890
  } finally {
891
891
  state0.a = a;
892
892
  }
@@ -966,12 +966,12 @@ var __wbg_get_imports = function() {
966
966
  const ret = wasm.memory;
967
967
  return addHeapObject(ret);
968
968
  };
969
- imports.wbg.__wbindgen_closure_wrapper2304 = function(arg0, arg1, arg2) {
970
- const ret = makeMutClosure(arg0, arg1, 424, __wbg_adapter_54);
969
+ imports.wbg.__wbindgen_closure_wrapper2418 = function(arg0, arg1, arg2) {
970
+ const ret = makeMutClosure(arg0, arg1, 626, __wbg_adapter_54);
971
971
  return addHeapObject(ret);
972
972
  };
973
- imports.wbg.__wbindgen_closure_wrapper10033 = function(arg0, arg1, arg2) {
974
- const ret = makeMutClosure(arg0, arg1, 1396, __wbg_adapter_57);
973
+ imports.wbg.__wbindgen_closure_wrapper9150 = function(arg0, arg1, arg2) {
974
+ const ret = makeMutClosure(arg0, arg1, 1468, __wbg_adapter_57);
975
975
  return addHeapObject(ret);
976
976
  };
977
977
  return imports;
@@ -1033,26 +1033,12 @@ var cachedFloat64Memory0 = null;
1033
1033
  var cachedBigInt64Memory0 = null;
1034
1034
  var cachedUint32Memory0 = null;
1035
1035
  var cachedUint16Memory0 = null;
1036
- var DeviceStatus = Object.freeze({
1037
- Valid: 0,
1038
- "0": "Valid",
1039
- Expired: 1,
1040
- "1": "Expired",
1041
- Revoked: 2,
1042
- "2": "Revoked"
1043
- });
1044
1036
  var CredentialType = Object.freeze({
1045
1037
  Basic: 1,
1046
1038
  "1": "Basic",
1047
1039
  X509: 2,
1048
1040
  "2": "X509"
1049
1041
  });
1050
- var WirePolicy = Object.freeze({
1051
- Plaintext: 1,
1052
- "1": "Plaintext",
1053
- Ciphertext: 2,
1054
- "2": "Ciphertext"
1055
- });
1056
1042
  var Ciphersuite = Object.freeze({
1057
1043
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1058
1044
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1071,6 +1057,20 @@ var Ciphersuite = Object.freeze({
1071
1057
  MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519: 61489,
1072
1058
  "61489": "MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519"
1073
1059
  });
1060
+ var DeviceStatus = Object.freeze({
1061
+ Valid: 0,
1062
+ "0": "Valid",
1063
+ Expired: 1,
1064
+ "1": "Expired",
1065
+ Revoked: 2,
1066
+ "2": "Revoked"
1067
+ });
1068
+ var WirePolicy = Object.freeze({
1069
+ Plaintext: 1,
1070
+ "1": "Plaintext",
1071
+ Ciphertext: 2,
1072
+ "2": "Ciphertext"
1073
+ });
1074
1074
 
1075
1075
  class AcmeChallenge {
1076
1076
  static __wrap(ptr) {
@@ -1310,12 +1310,12 @@ class ConversationConfiguration {
1310
1310
  const ptr = this.__destroy_into_raw();
1311
1311
  wasm.__wbg_conversationconfiguration_free(ptr);
1312
1312
  }
1313
- constructor(ciphersuite, external_senders, key_rotation_span, wire_policy, per_domain_trust_anchors) {
1313
+ constructor(ciphersuite, external_senders, key_rotation_span, wire_policy) {
1314
1314
  try {
1315
1315
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1316
1316
  var ptr0 = isLikeNone(external_senders) ? 0 : passArrayJsValueToWasm0(external_senders, wasm.__wbindgen_malloc);
1317
1317
  var len0 = WASM_VECTOR_LEN;
1318
- wasm.conversationconfiguration_new(retptr, isLikeNone(ciphersuite) ? 8 : ciphersuite, ptr0, len0, !isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, isLikeNone(wire_policy) ? 3 : wire_policy, addHeapObject(per_domain_trust_anchors));
1318
+ wasm.conversationconfiguration_new(retptr, isLikeNone(ciphersuite) ? 8 : ciphersuite, ptr0, len0, !isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, isLikeNone(wire_policy) ? 3 : wire_policy);
1319
1319
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1320
1320
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1321
1321
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1627,14 +1627,6 @@ class CoreCrypto {
1627
1627
  const ret = wasm.corecrypto_encrypt_message(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1628
1628
  return takeObject(ret);
1629
1629
  }
1630
- update_trust_anchors_from_conversation(conversation_id, remove_domain_names, add_trust_anchors) {
1631
- const ptr0 = passArray8ToWasm0(conversation_id, wasm.__wbindgen_malloc);
1632
- const len0 = WASM_VECTOR_LEN;
1633
- const ptr1 = passArrayJsValueToWasm0(remove_domain_names, wasm.__wbindgen_malloc);
1634
- const len1 = WASM_VECTOR_LEN;
1635
- const ret = wasm.corecrypto_update_trust_anchors_from_conversation(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(add_trust_anchors));
1636
- return takeObject(ret);
1637
- }
1638
1630
  new_add_proposal(conversation_id, keypackage) {
1639
1631
  const ptr0 = passArray8ToWasm0(conversation_id, wasm.__wbindgen_malloc);
1640
1632
  const len0 = WASM_VECTOR_LEN;
@@ -1986,8 +1978,7 @@ class FfiWireE2EIdentity {
1986
1978
  }
1987
1979
  new_oidc_challenge_response(cc, challenge) {
1988
1980
  _assertClass(cc, CoreCrypto);
1989
- var ptr0 = cc.__destroy_into_raw();
1990
- const ret = wasm.ffiwiree2eidentity_new_oidc_challenge_response(this.__wbg_ptr, ptr0, addHeapObject(challenge));
1981
+ const ret = wasm.ffiwiree2eidentity_new_oidc_challenge_response(this.__wbg_ptr, cc.__wbg_ptr, addHeapObject(challenge));
1991
1982
  return takeObject(ret);
1992
1983
  }
1993
1984
  check_order_request(order_url, previous_nonce) {
@@ -2138,6 +2129,7 @@ class NewAcmeOrder {
2138
2129
  }
2139
2130
  }
2140
2131
  }
2132
+
2141
2133
  class ProposalBundle {
2142
2134
  static __wrap(ptr) {
2143
2135
  ptr = ptr >>> 0;
@@ -2507,10 +2499,9 @@ class CoreCrypto2 {
2507
2499
  const {
2508
2500
  ciphersuite,
2509
2501
  externalSenders,
2510
- custom = {},
2511
- perDomainTrustAnchors = []
2502
+ custom = {}
2512
2503
  } = configuration || {};
2513
- const config = new ConversationConfiguration(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy, perDomainTrustAnchors);
2504
+ const config = new ConversationConfiguration(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy);
2514
2505
  const ret = await CoreCryptoError.asyncMapErr(this.#cc.create_conversation(conversationId, creatorCredentialType, config));
2515
2506
  return ret;
2516
2507
  } catch (e) {
@@ -2554,24 +2545,6 @@ class CoreCrypto2 {
2554
2545
  async encryptMessage(conversationId, message) {
2555
2546
  return await CoreCryptoError.asyncMapErr(this.#cc.encrypt_message(conversationId, message));
2556
2547
  }
2557
- async updateTrustAnchorsFromConversation(conversationId, removeDomainNames, addTrustAnchors) {
2558
- try {
2559
- const ffiRet = await CoreCryptoError.asyncMapErr(this.#cc.update_trust_anchors_from_conversation(conversationId, removeDomainNames, addTrustAnchors));
2560
- const gi = ffiRet.group_info;
2561
- const ret = {
2562
- welcome: ffiRet.welcome,
2563
- commit: ffiRet.commit,
2564
- groupInfo: {
2565
- encryptionType: gi.encryption_type,
2566
- ratchetTreeType: gi.ratchet_tree_type,
2567
- payload: gi.payload
2568
- }
2569
- };
2570
- return ret;
2571
- } catch (e) {
2572
- throw CoreCryptoError.fromStdError(e);
2573
- }
2574
- }
2575
2548
  async processWelcomeMessage(welcomeMessage, configuration = {}) {
2576
2549
  try {
2577
2550
  const { keyRotationSpan, wirePolicy } = configuration || {};