@wireapp/core-crypto 1.0.0-rc.18 → 1.0.0-rc.19

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": "1.0.0-rc.18",
3
+ "version": "1.0.0-rc.19",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -1,3 +1,22 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * see [core_crypto::prelude::DeviceStatus]
5
+ */
6
+ export enum DeviceStatus {
7
+ /**
8
+ * All is fine
9
+ */
10
+ Valid = 0,
11
+ /**
12
+ * The Credential's certificate is expired
13
+ */
14
+ Expired = 1,
15
+ /**
16
+ * The Credential's certificate is revoked (not implemented yet)
17
+ */
18
+ Revoked = 2
19
+ }
1
20
  /**
2
21
  * For creating a challenge.
3
22
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
@@ -74,6 +93,41 @@ export class NewAcmeOrder {
74
93
  */
75
94
  readonly delegate: Uint8Array;
76
95
  }
96
+ /**
97
+ * Represents the identity claims identifying a client
98
+ * Those claims are verifiable by any member in the group
99
+ */
100
+ export class WireIdentity {
101
+ free(): void;
102
+ /**
103
+ * X509 certificate identifying this client in the MLS group ; PEM encoded
104
+ */
105
+ readonly certificate: string;
106
+ /**
107
+ * Unique client identifier e.g. `T4Coy4vdRzianwfOgXpn6A:6add501bacd1d90e@whitehouse.gov`
108
+ */
109
+ readonly clientId: string;
110
+ /**
111
+ * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
112
+ */
113
+ readonly displayName: string;
114
+ /**
115
+ * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
116
+ */
117
+ readonly domain: string;
118
+ /**
119
+ * user handle e.g. `john_wire`
120
+ */
121
+ readonly handle: string;
122
+ /**
123
+ * Status of the Credential at the moment T when this object is created
124
+ */
125
+ readonly status: DeviceStatus;
126
+ /**
127
+ * MLS thumbprint
128
+ */
129
+ readonly thumbprint: string;
130
+ }
77
131
  /**
78
132
  * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
79
133
  *
@@ -506,31 +560,6 @@ export interface BufferedDecryptedMessage {
506
560
  */
507
561
  identity?: WireIdentity;
508
562
  }
509
- /**
510
- * Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
511
- */
512
- export interface WireIdentity {
513
- /**
514
- * Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
515
- */
516
- clientId: string;
517
- /**
518
- * user handle e.g. `john_wire`
519
- */
520
- handle: string;
521
- /**
522
- * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
523
- */
524
- displayName: string;
525
- /**
526
- * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
527
- */
528
- domain: string;
529
- /**
530
- * X509 certificate identifying this client in the MLS group ; PEM encoded
531
- */
532
- certificate: string;
533
- }
534
563
  /**
535
564
  * Returned by all methods creating proposals. Contains a proposal message and an identifier to roll back the proposal
536
565
  */
@@ -1278,10 +1307,20 @@ export declare class CoreCrypto {
1278
1307
  * Certificate Credential (after turning on end-to-end identity).
1279
1308
  *
1280
1309
  * @param conversationId - identifier of the conversation
1281
- * @param clientIds - identifiers of the user
1310
+ * @param deviceIds - identifiers of the devices
1282
1311
  * @returns identities or if no member has a x509 certificate, it will return an empty List
1283
1312
  */
1284
- getUserIdentities(conversationId: ConversationId, clientIds: ClientId[]): Promise<WireIdentity[]>;
1313
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
1314
+ /**
1315
+ * From a given conversation, get the identity of the users (device holders) supplied.
1316
+ * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
1317
+ * If no member has a x509 certificate, it will return an empty Vec.
1318
+ *
1319
+ * @param conversationId - identifier of the conversation
1320
+ * @param userIds - user identifiers e.g. t6wRpI8BRSeviBwwiFp5MQ which is a base64UrlUnpadded UUIDv4
1321
+ * @returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
1322
+ */
1323
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
1285
1324
  /**
1286
1325
  * Returns the current version of {@link CoreCrypto}
1287
1326
  *
@@ -1,12 +1,4 @@
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
2
  var getObject = function(idx) {
11
3
  return heap[idx];
12
4
  };
@@ -21,6 +13,14 @@ var takeObject = function(idx) {
21
13
  dropObject(idx);
22
14
  return ret;
23
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
24
  var getUint8Memory0 = function() {
25
25
  if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
26
26
  cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
@@ -157,12 +157,12 @@ var makeMutClosure = function(arg0, arg1, dtor, f) {
157
157
  return real;
158
158
  };
159
159
  var __wbg_adapter_52 = function(arg0, arg1, arg2) {
160
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h0f2a9dd0c610e808(arg0, arg1, addHeapObject(arg2));
160
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__haa59db12f6db579c(arg0, arg1, addHeapObject(arg2));
161
161
  };
162
162
  var __wbg_adapter_55 = 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__hb74a6b2f1fdadeb5(retptr, arg0, arg1, addHeapObject(arg2));
165
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__hceafba4929294a2f(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_396 = function(arg0, arg1, arg2, arg3) {
236
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h9c95ec8d3b398f12(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
235
+ var __wbg_adapter_398 = function(arg0, arg1, arg2, arg3) {
236
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h61cfff0f57bf91cc(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,35 +262,35 @@ 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_buffereddecryptedmessage_new = function(arg0) {
266
- const ret = BufferedDecryptedMessage.__wrap(arg0);
267
- return addHeapObject(ret);
265
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
266
+ takeObject(arg0);
268
267
  };
269
- imports.wbg.__wbindgen_number_new = function(arg0) {
270
- const ret = arg0;
268
+ imports.wbg.__wbg_commitbundle_new = function(arg0) {
269
+ const ret = CommitBundle.__wrap(arg0);
271
270
  return addHeapObject(ret);
272
271
  };
273
- imports.wbg.__wbg_corecrypto_new = function(arg0) {
274
- const ret = CoreCrypto.__wrap(arg0);
272
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
273
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
275
274
  return addHeapObject(ret);
276
275
  };
277
276
  imports.wbg.__wbg_proposalbundle_new = function(arg0) {
278
277
  const ret = ProposalBundle.__wrap(arg0);
279
278
  return addHeapObject(ret);
280
279
  };
281
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
282
- takeObject(arg0);
280
+ imports.wbg.__wbindgen_number_new = function(arg0) {
281
+ const ret = arg0;
282
+ return addHeapObject(ret);
283
283
  };
284
284
  imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
285
285
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
286
286
  return addHeapObject(ret);
287
287
  };
288
- imports.wbg.__wbg_commitbundle_new = function(arg0) {
289
- const ret = CommitBundle.__wrap(arg0);
288
+ imports.wbg.__wbg_corecrypto_new = function(arg0) {
289
+ const ret = CoreCrypto.__wrap(arg0);
290
290
  return addHeapObject(ret);
291
291
  };
292
- imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
293
- const ret = FfiWireE2EIdentity.__wrap(arg0);
292
+ imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
293
+ const ret = BufferedDecryptedMessage.__wrap(arg0);
294
294
  return addHeapObject(ret);
295
295
  };
296
296
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
@@ -870,7 +870,7 @@ var __wbg_get_imports = function() {
870
870
  const a = state0.a;
871
871
  state0.a = 0;
872
872
  try {
873
- return __wbg_adapter_396(a, state0.b, arg02, arg12);
873
+ return __wbg_adapter_398(a, state0.b, arg02, arg12);
874
874
  } finally {
875
875
  state0.a = a;
876
876
  }
@@ -950,12 +950,12 @@ var __wbg_get_imports = function() {
950
950
  const ret = wasm.memory;
951
951
  return addHeapObject(ret);
952
952
  };
953
- imports.wbg.__wbindgen_closure_wrapper2215 = function(arg0, arg1, arg2) {
954
- const ret = makeMutClosure(arg0, arg1, 353, __wbg_adapter_52);
953
+ imports.wbg.__wbindgen_closure_wrapper2230 = function(arg0, arg1, arg2) {
954
+ const ret = makeMutClosure(arg0, arg1, 357, __wbg_adapter_52);
955
955
  return addHeapObject(ret);
956
956
  };
957
- imports.wbg.__wbindgen_closure_wrapper9851 = function(arg0, arg1, arg2) {
958
- const ret = makeMutClosure(arg0, arg1, 1327, __wbg_adapter_55);
957
+ imports.wbg.__wbindgen_closure_wrapper9979 = function(arg0, arg1, arg2) {
958
+ const ret = makeMutClosure(arg0, arg1, 1317, __wbg_adapter_55);
959
959
  return addHeapObject(ret);
960
960
  };
961
961
  return imports;
@@ -1017,6 +1017,26 @@ if (typeof TextDecoder !== "undefined") {
1017
1017
  var cachedBigInt64Memory0 = null;
1018
1018
  var cachedUint32Memory0 = null;
1019
1019
  var cachedUint16Memory0 = null;
1020
+ var DeviceStatus = Object.freeze({
1021
+ Valid: 0,
1022
+ "0": "Valid",
1023
+ Expired: 1,
1024
+ "1": "Expired",
1025
+ Revoked: 2,
1026
+ "2": "Revoked"
1027
+ });
1028
+ var CredentialType = Object.freeze({
1029
+ Basic: 1,
1030
+ "1": "Basic",
1031
+ X509: 2,
1032
+ "2": "X509"
1033
+ });
1034
+ var WirePolicy = Object.freeze({
1035
+ Plaintext: 1,
1036
+ "1": "Plaintext",
1037
+ Ciphertext: 2,
1038
+ "2": "Ciphertext"
1039
+ });
1020
1040
  var Ciphersuite = Object.freeze({
1021
1041
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1022
1042
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1035,18 +1055,6 @@ var Ciphersuite = Object.freeze({
1035
1055
  MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519: 61489,
1036
1056
  "61489": "MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519"
1037
1057
  });
1038
- var WirePolicy = Object.freeze({
1039
- Plaintext: 1,
1040
- "1": "Plaintext",
1041
- Ciphertext: 2,
1042
- "2": "Ciphertext"
1043
- });
1044
- var CredentialType = Object.freeze({
1045
- Basic: 1,
1046
- "1": "Basic",
1047
- X509: 2,
1048
- "2": "X509"
1049
- });
1050
1058
 
1051
1059
  class AcmeChallenge {
1052
1060
  static __wrap(ptr) {
@@ -1389,10 +1397,18 @@ class CoreCrypto {
1389
1397
  const ret = wasm.corecrypto_e2ei_is_enabled(this.__wbg_ptr, ciphersuite);
1390
1398
  return takeObject(ret);
1391
1399
  }
1392
- get_user_identities(conversation_id, client_ids) {
1400
+ get_device_identities(conversation_id, device_ids) {
1401
+ const ptr0 = passArray8ToWasm0(conversation_id, wasm.__wbindgen_malloc);
1402
+ const len0 = WASM_VECTOR_LEN;
1403
+ const ptr1 = passArrayJsValueToWasm0(device_ids, wasm.__wbindgen_malloc);
1404
+ const len1 = WASM_VECTOR_LEN;
1405
+ const ret = wasm.corecrypto_get_device_identities(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1406
+ return takeObject(ret);
1407
+ }
1408
+ get_user_identities(conversation_id, user_ids) {
1393
1409
  const ptr0 = passArray8ToWasm0(conversation_id, wasm.__wbindgen_malloc);
1394
1410
  const len0 = WASM_VECTOR_LEN;
1395
- const ptr1 = passArrayJsValueToWasm0(client_ids, wasm.__wbindgen_malloc);
1411
+ const ptr1 = passArrayJsValueToWasm0(user_ids, wasm.__wbindgen_malloc);
1396
1412
  const len1 = WASM_VECTOR_LEN;
1397
1413
  const ret = wasm.corecrypto_get_user_identities(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1398
1414
  return takeObject(ret);
@@ -2391,27 +2407,12 @@ class WireIdentity {
2391
2407
  const ptr = this.__destroy_into_raw();
2392
2408
  wasm.__wbg_wireidentity_free(ptr);
2393
2409
  }
2394
- constructor(client_id, handle, display_name, domain, certificate) {
2395
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2396
- const len0 = WASM_VECTOR_LEN;
2397
- const ptr1 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2398
- const len1 = WASM_VECTOR_LEN;
2399
- const ptr2 = passStringToWasm0(display_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2400
- const len2 = WASM_VECTOR_LEN;
2401
- const ptr3 = passStringToWasm0(domain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2402
- const len3 = WASM_VECTOR_LEN;
2403
- const ptr4 = passStringToWasm0(certificate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2404
- const len4 = WASM_VECTOR_LEN;
2405
- const ret = wasm.wireidentity_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
2406
- this.__wbg_ptr = ret >>> 0;
2407
- return this;
2408
- }
2409
- get client_id() {
2410
+ get clientId() {
2410
2411
  let deferred1_0;
2411
2412
  let deferred1_1;
2412
2413
  try {
2413
2414
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2414
- wasm.wireidentity_client_id(retptr, this.__wbg_ptr);
2415
+ wasm.__wbg_get_acmedirectory_newNonce(retptr, this.__wbg_ptr);
2415
2416
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2416
2417
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2417
2418
  deferred1_0 = r0;
@@ -2427,7 +2428,7 @@ class WireIdentity {
2427
2428
  let deferred1_1;
2428
2429
  try {
2429
2430
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2430
- wasm.wireidentity_handle(retptr, this.__wbg_ptr);
2431
+ wasm.__wbg_get_acmechallenge_url(retptr, this.__wbg_ptr);
2431
2432
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2432
2433
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2433
2434
  deferred1_0 = r0;
@@ -2438,12 +2439,12 @@ class WireIdentity {
2438
2439
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2439
2440
  }
2440
2441
  }
2441
- get display_name() {
2442
+ get displayName() {
2442
2443
  let deferred1_0;
2443
2444
  let deferred1_1;
2444
2445
  try {
2445
2446
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2446
- wasm.wireidentity_display_name(retptr, this.__wbg_ptr);
2447
+ wasm.__wbg_get_acmechallenge_target(retptr, this.__wbg_ptr);
2447
2448
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2448
2449
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2449
2450
  deferred1_0 = r0;
@@ -2459,7 +2460,7 @@ class WireIdentity {
2459
2460
  let deferred1_1;
2460
2461
  try {
2461
2462
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2462
- wasm.wireidentity_domain(retptr, this.__wbg_ptr);
2463
+ wasm.__wbg_get_acmedirectory_revokeCert(retptr, this.__wbg_ptr);
2463
2464
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2464
2465
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2465
2466
  deferred1_0 = r0;
@@ -2475,7 +2476,27 @@ class WireIdentity {
2475
2476
  let deferred1_1;
2476
2477
  try {
2477
2478
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2478
- wasm.wireidentity_certificate(retptr, this.__wbg_ptr);
2479
+ wasm.__wbg_get_wireidentity_certificate(retptr, this.__wbg_ptr);
2480
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2481
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2482
+ deferred1_0 = r0;
2483
+ deferred1_1 = r1;
2484
+ return getStringFromWasm0(r0, r1);
2485
+ } finally {
2486
+ wasm.__wbindgen_add_to_stack_pointer(16);
2487
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2488
+ }
2489
+ }
2490
+ get status() {
2491
+ const ret = wasm.__wbg_get_wireidentity_status(this.__wbg_ptr);
2492
+ return ret;
2493
+ }
2494
+ get thumbprint() {
2495
+ let deferred1_0;
2496
+ let deferred1_1;
2497
+ try {
2498
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2499
+ wasm.__wbg_get_wireidentity_thumbprint(retptr, this.__wbg_ptr);
2479
2500
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2480
2501
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2481
2502
  deferred1_0 = r0;
@@ -3006,8 +3027,11 @@ class CoreCrypto2 {
3006
3027
  async e2eiIsEnabled(ciphersuite) {
3007
3028
  return await CoreCryptoError.asyncMapErr(this.#cc.e2ei_is_enabled(ciphersuite));
3008
3029
  }
3009
- async getUserIdentities(conversationId, clientIds) {
3010
- return await CoreCryptoError.asyncMapErr(this.#cc.get_user_identities(conversationId, clientIds));
3030
+ async getDeviceIdentities(conversationId, deviceIds) {
3031
+ return await CoreCryptoError.asyncMapErr(this.#cc.get_device_identities(conversationId, deviceIds));
3032
+ }
3033
+ async getUserIdentities(conversationId, userIds) {
3034
+ return await CoreCryptoError.asyncMapErr(this.#cc.get_user_identities(conversationId, userIds));
3011
3035
  }
3012
3036
  static version() {
3013
3037
  this.#assertModuleLoaded();
@@ -3147,6 +3171,7 @@ var E2eiConversationState;
3147
3171
  })(E2eiConversationState || (E2eiConversationState = {}));
3148
3172
  export {
3149
3173
  WirePolicy2 as WirePolicy,
3174
+ WireIdentity,
3150
3175
  RatchetTreeType,
3151
3176
  ProposalType,
3152
3177
  NewAcmeOrder,
@@ -3155,6 +3180,7 @@ export {
3155
3180
  ExternalProposalType,
3156
3181
  E2eiEnrollment,
3157
3182
  E2eiConversationState,
3183
+ DeviceStatus,
3158
3184
  CredentialType2 as CredentialType,
3159
3185
  CoreCryptoError,
3160
3186
  CoreCrypto2 as CoreCrypto,