@wireapp/core-crypto 4.2.3 → 5.0.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": "4.2.3",
3
+ "version": "5.0.0",
4
4
  "author": "Wire CoreCrypto team <team.corecrypto@wire.com>",
5
5
  "repository": {
6
6
  "type": "git",
Binary file
@@ -152,6 +152,7 @@ export const __wbg_get_buildmetadata_gitBranch: (a: number) => [number, number];
152
152
  export const __wbg_get_buildmetadata_gitDescribe: (a: number) => [number, number];
153
153
  export const __wbg_get_buildmetadata_gitSha: (a: number) => [number, number];
154
154
  export const __wbg_get_buildmetadata_gitDirty: (a: number) => [number, number];
155
+ export const corecrypto_register_epoch_observer: (a: number, b: any) => any;
155
156
  export const corecryptocontext_set_data: (a: number, b: number, c: number) => any;
156
157
  export const corecryptocontext_get_data: (a: number) => any;
157
158
  export const corecryptocontext_mls_init: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
@@ -216,11 +217,11 @@ export const corecryptocontext_e2ei_is_enabled: (a: number, b: number) => any;
216
217
  export const corecryptocontext_get_device_identities: (a: number, b: number, c: number, d: number, e: number) => any;
217
218
  export const corecryptocontext_get_user_identities: (a: number, b: number, c: number, d: number, e: number) => any;
218
219
  export const corecryptocontext_get_credential_in_use: (a: number, b: number, c: number, d: number) => any;
219
- export const corecryptocontext_proteus_last_resort_prekey_id: () => [number, number, number];
220
220
  export const __wbg_get_newacmeauthz_identifier: (a: number) => [number, number];
221
221
  export const __wbg_get_acmedirectory_new_account: (a: number) => [number, number];
222
222
  export const __wbg_get_acmedirectory_new_order: (a: number) => [number, number];
223
223
  export const __wbg_get_e2eidumpedpkienv_root_ca: (a: number) => [number, number];
224
+ export const corecryptocontext_proteus_last_resort_prekey_id: () => [number, number, number];
224
225
  export const __wbg_proteusautoprekeybundle_free: (a: number, b: number) => void;
225
226
  export const corecryptocontext_proteus_fingerprint_prekeybundle: (a: number, b: number) => [number, number, number, number];
226
227
  export const __wbindgen_malloc: (a: number, b: number) => number;
@@ -228,12 +229,12 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
228
229
  export const __wbindgen_exn_store: (a: number) => void;
229
230
  export const __externref_table_alloc: () => number;
230
231
  export const __wbindgen_export_4: WebAssembly.Table;
231
- export const __wbindgen_export_5: WebAssembly.Table;
232
232
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
233
+ export const __wbindgen_export_6: WebAssembly.Table;
233
234
  export const __externref_drop_slice: (a: number, b: number) => void;
234
235
  export const __externref_table_dealloc: (a: number) => void;
235
- export const closure877_externref_shim: (a: number, b: number, c: any) => void;
236
- export const closure2567_externref_shim: (a: number, b: number, c: any) => void;
237
- export const closure2763_externref_shim: (a: number, b: number, c: any) => void;
238
- export const closure2850_externref_shim: (a: number, b: number, c: any, d: any) => void;
236
+ export const closure896_externref_shim: (a: number, b: number, c: any) => void;
237
+ export const closure2583_externref_shim: (a: number, b: number, c: any) => void;
238
+ export const closure2781_externref_shim: (a: number, b: number, c: any) => void;
239
+ export const closure2867_externref_shim: (a: number, b: number, c: any, d: any) => void;
239
240
  export const __wbindgen_start: () => void;
@@ -1866,6 +1866,9 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
1866
1866
  */
1867
1867
  nbKeyPackage?: number;
1868
1868
  }
1869
+ export interface EpochObserver {
1870
+ epochChanged(conversationId: ConversationId, epoch: number): Promise<void>;
1871
+ }
1869
1872
  /**
1870
1873
  * Initializes the global logger for Core Crypto and registers the callback.
1871
1874
  *
@@ -2153,6 +2156,13 @@ export declare class CoreCrypto {
2153
2156
  * @returns see {@link E2eiConversationState}
2154
2157
  */
2155
2158
  getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
2159
+ /**
2160
+ * Registers an epoch observer, which will then be notified every time a conversation's epoch changes.
2161
+ *
2162
+ * @param observer must conform to the {@link EpochObserver} interface
2163
+ * @returns nothing
2164
+ */
2165
+ registerEpochObserver(observer: EpochObserver): Promise<void>;
2156
2166
  }
2157
2167
 
2158
2168
  export {
package/src/corecrypto.js CHANGED
@@ -160,11 +160,15 @@ function getStringFromWasm0(ptr, len) {
160
160
  ptr = ptr >>> 0;
161
161
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
162
162
  }
163
+ function getArrayU8FromWasm0(ptr, len) {
164
+ ptr = ptr >>> 0;
165
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
166
+ }
163
167
  function isLikeNone(x) {
164
168
  return x === undefined || x === null;
165
169
  }
166
170
  var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => {
167
- wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b);
171
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
168
172
  });
169
173
  function makeMutClosure(arg0, arg1, dtor, f) {
170
174
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
@@ -176,7 +180,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
176
180
  return f(a, state.b, ...args);
177
181
  } finally {
178
182
  if (--state.cnt === 0) {
179
- wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
183
+ wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
180
184
  CLOSURE_DTORS.unregister(state);
181
185
  } else {
182
186
  state.a = a;
@@ -243,10 +247,6 @@ ${val.stack}`;
243
247
  }
244
248
  return className;
245
249
  }
246
- function getArrayU8FromWasm0(ptr, len) {
247
- ptr = ptr >>> 0;
248
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
249
- }
250
250
  function getArrayJsValueFromWasm0(ptr, len) {
251
251
  ptr = ptr >>> 0;
252
252
  const mem = getDataViewMemory0();
@@ -296,16 +296,16 @@ function takeFromExternrefTable0(idx) {
296
296
  return value;
297
297
  }
298
298
  function __wbg_adapter_60(arg0, arg1, arg2) {
299
- wasm.closure877_externref_shim(arg0, arg1, arg2);
299
+ wasm.closure896_externref_shim(arg0, arg1, arg2);
300
300
  }
301
301
  function __wbg_adapter_63(arg0, arg1, arg2) {
302
- wasm.closure2567_externref_shim(arg0, arg1, arg2);
302
+ wasm.closure2583_externref_shim(arg0, arg1, arg2);
303
303
  }
304
304
  function __wbg_adapter_66(arg0, arg1, arg2) {
305
- wasm.closure2763_externref_shim(arg0, arg1, arg2);
305
+ wasm.closure2781_externref_shim(arg0, arg1, arg2);
306
306
  }
307
- function __wbg_adapter_497(arg0, arg1, arg2, arg3) {
308
- wasm.closure2850_externref_shim(arg0, arg1, arg2, arg3);
307
+ function __wbg_adapter_506(arg0, arg1, arg2, arg3) {
308
+ wasm.closure2867_externref_shim(arg0, arg1, arg2, arg3);
309
309
  }
310
310
  var Ciphersuite = Object.freeze({
311
311
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
@@ -900,6 +900,10 @@ class CoreCrypto {
900
900
  const ret = wasm.corecrypto_get_client_ids(this.__wbg_ptr, ptr0, len0);
901
901
  return ret;
902
902
  }
903
+ register_epoch_observer(epoch_observer) {
904
+ const ret = wasm.corecrypto_register_epoch_observer(this.__wbg_ptr, epoch_observer);
905
+ return ret;
906
+ }
903
907
  transaction(command) {
904
908
  const ret = wasm.corecrypto_transaction(this.__wbg_ptr, command);
905
909
  return ret;
@@ -2090,6 +2094,14 @@ function __wbg_get_imports() {
2090
2094
  const ret = Object.entries(arg0);
2091
2095
  return ret;
2092
2096
  };
2097
+ imports.wbg.__wbg_epochchanged_1c4fa93ea9e2b0bc = function() {
2098
+ return handleError(function(arg0, arg1, arg2, arg3) {
2099
+ var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
2100
+ wasm.__wbindgen_free(arg1, arg2 * 1, 1);
2101
+ const ret = arg0.epoch_changed(v0, BigInt.asUintN(64, arg3));
2102
+ return ret;
2103
+ }, arguments);
2104
+ };
2093
2105
  imports.wbg.__wbg_error_4e9ba4ac0ad780bd = function(arg0) {
2094
2106
  console.error(arg0);
2095
2107
  };
@@ -2097,13 +2109,24 @@ function __wbg_get_imports() {
2097
2109
  const ret = arg0.error;
2098
2110
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2099
2111
  };
2112
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
2113
+ let deferred0_0;
2114
+ let deferred0_1;
2115
+ try {
2116
+ deferred0_0 = arg0;
2117
+ deferred0_1 = arg1;
2118
+ console.error(getStringFromWasm0(arg0, arg1));
2119
+ } finally {
2120
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2121
+ }
2122
+ };
2100
2123
  imports.wbg.__wbg_error_dae0861a350d0654 = function() {
2101
2124
  return handleError(function(arg0) {
2102
2125
  const ret = arg0.error;
2103
2126
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2104
2127
  }, arguments);
2105
2128
  };
2106
- imports.wbg.__wbg_execute_d40121546ec0b66d = function() {
2129
+ imports.wbg.__wbg_execute_077721bcdc99f713 = function() {
2107
2130
  return handleError(function(arg0, arg1) {
2108
2131
  const ret = arg0.execute(CoreCryptoContext.__wrap(arg1));
2109
2132
  return ret;
@@ -2339,7 +2362,7 @@ function __wbg_get_imports() {
2339
2362
  const a = state0.a;
2340
2363
  state0.a = 0;
2341
2364
  try {
2342
- return __wbg_adapter_497(a, state0.b, arg02, arg12);
2365
+ return __wbg_adapter_506(a, state0.b, arg02, arg12);
2343
2366
  } finally {
2344
2367
  state0.a = a;
2345
2368
  }
@@ -2362,6 +2385,10 @@ function __wbg_get_imports() {
2362
2385
  const ret = new Map;
2363
2386
  return ret;
2364
2387
  };
2388
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
2389
+ const ret = new Error;
2390
+ return ret;
2391
+ };
2365
2392
  imports.wbg.__wbg_new_c964b02f4996f6b4 = function(arg0, arg1) {
2366
2393
  const ret = new Error(getStringFromWasm0(arg0, arg1));
2367
2394
  return ret;
@@ -2574,6 +2601,13 @@ function __wbg_get_imports() {
2574
2601
  imports.wbg.__wbg_setunique_3643f794d7489985 = function(arg0, arg1) {
2575
2602
  arg0.unique = arg1 !== 0;
2576
2603
  };
2604
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
2605
+ const ret = arg1.stack;
2606
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2607
+ const len1 = WASM_VECTOR_LEN;
2608
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2609
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2610
+ };
2577
2611
  imports.wbg.__wbg_subarray_a984c21c3cf98bbb = function(arg0, arg1, arg2) {
2578
2612
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
2579
2613
  return ret;
@@ -2675,16 +2709,16 @@ function __wbg_get_imports() {
2675
2709
  const ret = false;
2676
2710
  return ret;
2677
2711
  };
2678
- imports.wbg.__wbindgen_closure_wrapper13790 = function(arg0, arg1, arg2) {
2679
- const ret = makeMutClosure(arg0, arg1, 2568, __wbg_adapter_63);
2712
+ imports.wbg.__wbindgen_closure_wrapper13852 = function(arg0, arg1, arg2) {
2713
+ const ret = makeMutClosure(arg0, arg1, 2584, __wbg_adapter_63);
2680
2714
  return ret;
2681
2715
  };
2682
- imports.wbg.__wbindgen_closure_wrapper14823 = function(arg0, arg1, arg2) {
2683
- const ret = makeMutClosure(arg0, arg1, 2764, __wbg_adapter_66);
2716
+ imports.wbg.__wbindgen_closure_wrapper14887 = function(arg0, arg1, arg2) {
2717
+ const ret = makeMutClosure(arg0, arg1, 2782, __wbg_adapter_66);
2684
2718
  return ret;
2685
2719
  };
2686
- imports.wbg.__wbindgen_closure_wrapper3626 = function(arg0, arg1, arg2) {
2687
- const ret = makeMutClosure(arg0, arg1, 878, __wbg_adapter_60);
2720
+ imports.wbg.__wbindgen_closure_wrapper3692 = function(arg0, arg1, arg2) {
2721
+ const ret = makeMutClosure(arg0, arg1, 897, __wbg_adapter_60);
2688
2722
  return ret;
2689
2723
  };
2690
2724
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@@ -3435,6 +3469,14 @@ class CoreCrypto2 {
3435
3469
  const state = await CoreCryptoError.asyncMapErr(this.#cc.get_credential_in_use(groupInfo, credentialType));
3436
3470
  return normalizeEnum(E2eiConversationState, state);
3437
3471
  }
3472
+ async registerEpochObserver(observer) {
3473
+ const observerIndirector = {
3474
+ async epoch_changed(conversation_id, epoch) {
3475
+ observer.epochChanged(conversation_id, epoch);
3476
+ }
3477
+ };
3478
+ return await CoreCryptoError.asyncMapErr(this.#cc.register_epoch_observer(observerIndirector));
3479
+ }
3438
3480
  }
3439
3481
  // src/CoreCrypto.ts
3440
3482
  if (typeof window !== "undefined") {