@wireapp/core-crypto 0.6.0-rc.1 → 0.6.0-rc.3

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": "0.6.0-rc.1",
3
+ "version": "0.6.0-rc.3",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -750,6 +750,8 @@ export declare class CoreCrypto {
750
750
  /**
751
751
  * Locally persists a session to the keystore
752
752
  *
753
+ * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
754
+ *
753
755
  * @param sessionId - ID of the Proteus session
754
756
  */
755
757
  proteusSessionSave(sessionId: string): Promise<void>;
@@ -800,6 +802,12 @@ export declare class CoreCrypto {
800
802
  * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
801
803
  */
802
804
  proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
805
+ /**
806
+ * Creates a new prekey with an automatically generated ID..
807
+ *
808
+ * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
809
+ */
810
+ proteusNewPrekeyAuto(): Promise<Uint8Array>;
803
811
  /**
804
812
  * Proteus public key fingerprint
805
813
  * It's basically the public key encoded as an hex string
@@ -252,7 +252,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
252
252
  function __wbg_adapter_52(arg0, arg1, arg2) {
253
253
  try {
254
254
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
255
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h150b30eeb1e9e4d8(retptr, arg0, arg1, addHeapObject(arg2));
255
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h5a2d63dc59f76e61(retptr, arg0, arg1, addHeapObject(arg2));
256
256
  var r0 = getInt32Memory0()[retptr / 4 + 0];
257
257
  var r1 = getInt32Memory0()[retptr / 4 + 1];
258
258
  if (r1) {
@@ -264,7 +264,7 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
264
264
  }
265
265
 
266
266
  function __wbg_adapter_55(arg0, arg1, arg2) {
267
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heba224c0328f088b(arg0, arg1, addHeapObject(arg2));
267
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6d113a8418e47593(arg0, arg1, addHeapObject(arg2));
268
268
  }
269
269
 
270
270
  /**
@@ -328,8 +328,8 @@ function handleError(f, args) {
328
328
  function getArrayU8FromWasm0(ptr, len) {
329
329
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
330
330
  }
331
- function __wbg_adapter_219(arg0, arg1, arg2, arg3) {
332
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h35e2dd043ef02cb8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
331
+ function __wbg_adapter_220(arg0, arg1, arg2, arg3) {
332
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h05b8fb12110402b0(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
333
333
  }
334
334
 
335
335
  /**
@@ -1021,6 +1021,8 @@ class CoreCrypto$1 {
1021
1021
  /**
1022
1022
  * Returns: [`WasmCryptoResult<()>`]
1023
1023
  *
1024
+ * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
1025
+ *
1024
1026
  * see [core_crypto::proteus::ProteusCentral::session_save]
1025
1027
  * @param {string} session_id
1026
1028
  * @returns {Promise<any>}
@@ -1117,6 +1119,16 @@ class CoreCrypto$1 {
1117
1119
  return takeObject(ret);
1118
1120
  }
1119
1121
  /**
1122
+ * Returns: [`WasmCryptoResult<Uint8Array>`]
1123
+ *
1124
+ * see [core_crypto::proteus::ProteusCentral::new_prekey]
1125
+ * @returns {Promise<Uint8Array>}
1126
+ */
1127
+ proteus_new_prekey_auto() {
1128
+ const ret = wasm$1.corecrypto_proteus_new_prekey_auto(this.ptr);
1129
+ return takeObject(ret);
1130
+ }
1131
+ /**
1120
1132
  * Returns: [`WasmCryptoResult<String>`]
1121
1133
  *
1122
1134
  * see [core_crypto::proteus::ProteusCentral::fingerprint]
@@ -1576,14 +1588,14 @@ function getImports() {
1576
1588
  const ret = getObject(arg0);
1577
1589
  return addHeapObject(ret);
1578
1590
  };
1591
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1592
+ takeObject(arg0);
1593
+ };
1579
1594
  imports.wbg.__wbindgen_is_object = function(arg0) {
1580
1595
  const val = getObject(arg0);
1581
1596
  const ret = typeof(val) === 'object' && val !== null;
1582
1597
  return ret;
1583
1598
  };
1584
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1585
- takeObject(arg0);
1586
- };
1587
1599
  imports.wbg.__wbg_getwithrefkey_15c62c2b8546208d = function(arg0, arg1) {
1588
1600
  const ret = getObject(arg0)[getObject(arg1)];
1589
1601
  return addHeapObject(ret);
@@ -1689,13 +1701,13 @@ function getImports() {
1689
1701
  const ret = CoreCrypto$1.__wrap(arg0);
1690
1702
  return addHeapObject(ret);
1691
1703
  };
1704
+ imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
1705
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1706
+ };
1692
1707
  imports.wbg.__wbindgen_number_new = function(arg0) {
1693
1708
  const ret = arg0;
1694
1709
  return addHeapObject(ret);
1695
1710
  };
1696
- imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
1697
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1698
- };
1699
1711
  imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
1700
1712
  const ret = new Object();
1701
1713
  return addHeapObject(ret);
@@ -1715,7 +1727,7 @@ function getImports() {
1715
1727
  const a = state0.a;
1716
1728
  state0.a = 0;
1717
1729
  try {
1718
- return __wbg_adapter_219(a, state0.b, arg0, arg1);
1730
+ return __wbg_adapter_220(a, state0.b, arg0, arg1);
1719
1731
  } finally {
1720
1732
  state0.a = a;
1721
1733
  }
@@ -1730,6 +1742,9 @@ function getImports() {
1730
1742
  const ret = new Array();
1731
1743
  return addHeapObject(ret);
1732
1744
  };
1745
+ imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
1746
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1747
+ };
1733
1748
  imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
1734
1749
  const ret = getObject(arg0).push(getObject(arg1));
1735
1750
  return ret;
@@ -1742,9 +1757,6 @@ function getImports() {
1742
1757
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1743
1758
  return addHeapObject(ret);
1744
1759
  };
1745
- imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
1746
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1747
- };
1748
1760
  imports.wbg.__wbg_call_3999bee59e9f7719 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1749
1761
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1750
1762
  return addHeapObject(ret);
@@ -1812,12 +1824,6 @@ function getImports() {
1812
1824
  const ret = false;
1813
1825
  return ret;
1814
1826
  };
1815
- imports.wbg.__wbg_setonsuccess_5f71593bc51653a3 = function(arg0, arg1) {
1816
- getObject(arg0).onsuccess = getObject(arg1);
1817
- };
1818
- imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
1819
- getObject(arg0).onerror = getObject(arg1);
1820
- };
1821
1827
  imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
1822
1828
  const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
1823
1829
  return addHeapObject(ret);
@@ -1829,6 +1835,28 @@ function getImports() {
1829
1835
  imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
1830
1836
  getObject(arg0).onupgradeneeded = getObject(arg1);
1831
1837
  };
1838
+ imports.wbg.__wbg_setonsuccess_5f71593bc51653a3 = function(arg0, arg1) {
1839
+ getObject(arg0).onsuccess = getObject(arg1);
1840
+ };
1841
+ imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
1842
+ getObject(arg0).onerror = getObject(arg1);
1843
+ };
1844
+ imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
1845
+ const ret = getObject(arg0).delete(getObject(arg1));
1846
+ return addHeapObject(ret);
1847
+ }, arguments) };
1848
+ imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
1849
+ const ret = getObject(arg0).count();
1850
+ return addHeapObject(ret);
1851
+ }, arguments) };
1852
+ imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
1853
+ const ret = getObject(arg0).count(getObject(arg1));
1854
+ return addHeapObject(ret);
1855
+ }, arguments) };
1856
+ imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
1857
+ const ret = getObject(arg0).get(getObject(arg1));
1858
+ return addHeapObject(ret);
1859
+ }, arguments) };
1832
1860
  imports.wbg.__wbg_put_84e7fc93eee27b28 = function() { return handleError(function (arg0, arg1, arg2) {
1833
1861
  const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
1834
1862
  return addHeapObject(ret);
@@ -1837,10 +1865,6 @@ function getImports() {
1837
1865
  const ret = getObject(arg0).put(getObject(arg1));
1838
1866
  return addHeapObject(ret);
1839
1867
  }, arguments) };
1840
- imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
1841
- const ret = getObject(arg0).delete(getObject(arg1));
1842
- return addHeapObject(ret);
1843
- }, arguments) };
1844
1868
  imports.wbg.__wbg_openCursor_e036069f0e326708 = function() { return handleError(function (arg0, arg1) {
1845
1869
  const ret = getObject(arg0).openCursor(getObject(arg1));
1846
1870
  return addHeapObject(ret);
@@ -1849,10 +1873,6 @@ function getImports() {
1849
1873
  const ret = getObject(arg0).openCursor();
1850
1874
  return addHeapObject(ret);
1851
1875
  }, arguments) };
1852
- imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
1853
- const ret = getObject(arg0).get(getObject(arg1));
1854
- return addHeapObject(ret);
1855
- }, arguments) };
1856
1876
  imports.wbg.__wbg_index_86861edf1478f49c = function() { return handleError(function (arg0, arg1, arg2) {
1857
1877
  const ret = getObject(arg0).index(getStringFromWasm0(arg1, arg2));
1858
1878
  return addHeapObject(ret);
@@ -1873,21 +1893,13 @@ function getImports() {
1873
1893
  const ret = getObject(arg0).openCursor(getObject(arg1));
1874
1894
  return addHeapObject(ret);
1875
1895
  }, arguments) };
1876
- imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
1877
- getObject(arg0).close();
1878
- };
1879
1896
  imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
1880
1897
  const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
1881
1898
  return addHeapObject(ret);
1882
1899
  }, arguments) };
1883
- imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
1884
- const ret = getObject(arg0).count();
1885
- return addHeapObject(ret);
1886
- }, arguments) };
1887
- imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
1888
- const ret = getObject(arg0).count(getObject(arg1));
1889
- return addHeapObject(ret);
1890
- }, arguments) };
1900
+ imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
1901
+ getObject(arg0).close();
1902
+ };
1891
1903
  imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
1892
1904
  getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
1893
1905
  }, arguments) };
@@ -2009,6 +2021,10 @@ function getImports() {
2009
2021
  const ret = getObject(arg0).result;
2010
2022
  return addHeapObject(ret);
2011
2023
  }, arguments) };
2024
+ imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
2025
+ const ret = getObject(arg0).error;
2026
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2027
+ }, arguments) };
2012
2028
  imports.wbg.__wbg_contains_6cf516181cd86571 = function(arg0, arg1, arg2) {
2013
2029
  const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
2014
2030
  return ret;
@@ -2035,10 +2051,6 @@ function getImports() {
2035
2051
  imports.wbg.__wbg_deleteObjectStore_1b698c5fd1bc077d = function() { return handleError(function (arg0, arg1, arg2) {
2036
2052
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
2037
2053
  }, arguments) };
2038
- imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
2039
- const ret = getObject(arg0).error;
2040
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2041
- }, arguments) };
2042
2054
  imports.wbg.__wbindgen_is_falsy = function(arg0) {
2043
2055
  const ret = !getObject(arg0);
2044
2056
  return ret;
@@ -2139,11 +2151,11 @@ function getImports() {
2139
2151
  const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
2140
2152
  return addHeapObject(ret);
2141
2153
  }, arguments) };
2142
- imports.wbg.__wbindgen_closure_wrapper2363 = function(arg0, arg1, arg2) {
2154
+ imports.wbg.__wbindgen_closure_wrapper2373 = function(arg0, arg1, arg2) {
2143
2155
  const ret = makeMutClosure(arg0, arg1, 122, __wbg_adapter_52);
2144
2156
  return addHeapObject(ret);
2145
2157
  };
2146
- imports.wbg.__wbindgen_closure_wrapper3837 = function(arg0, arg1, arg2) {
2158
+ imports.wbg.__wbindgen_closure_wrapper3847 = function(arg0, arg1, arg2) {
2147
2159
  const ret = makeMutClosure(arg0, arg1, 122, __wbg_adapter_55);
2148
2160
  return addHeapObject(ret);
2149
2161
  };
@@ -2214,7 +2226,7 @@ var exports = /*#__PURE__*/Object.freeze({
2214
2226
  var wasm = async (opt = {}) => {
2215
2227
  let {importHook, serverPath} = opt;
2216
2228
 
2217
- let path = "assets/core_crypto_ffi-b8c4f151.wasm";
2229
+ let path = "assets/core_crypto_ffi-69d2b02f.wasm";
2218
2230
 
2219
2231
  if (serverPath != null) {
2220
2232
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -2888,6 +2900,8 @@ class CoreCrypto {
2888
2900
  /**
2889
2901
  * Locally persists a session to the keystore
2890
2902
  *
2903
+ * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
2904
+ *
2891
2905
  * @param sessionId - ID of the Proteus session
2892
2906
  */
2893
2907
  async proteusSessionSave(sessionId) {
@@ -2952,6 +2966,14 @@ class CoreCrypto {
2952
2966
  async proteusNewPrekey(prekeyId) {
2953
2967
  return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_new_prekey(prekeyId);
2954
2968
  }
2969
+ /**
2970
+ * Creates a new prekey with an automatically generated ID..
2971
+ *
2972
+ * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
2973
+ */
2974
+ async proteusNewPrekeyAuto() {
2975
+ return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_new_prekey_auto();
2976
+ }
2955
2977
  /**
2956
2978
  * Proteus public key fingerprint
2957
2979
  * It's basically the public key encoded as an hex string