@wireapp/core-crypto 0.6.0-rc.2 → 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
Binary file
|
@@ -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
|
@@ -36,6 +36,15 @@ function getObject(idx) { return heap[idx]; }
|
|
36
36
|
|
37
37
|
let heap_next = heap.length;
|
38
38
|
|
39
|
+
function addHeapObject(obj) {
|
40
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
41
|
+
const idx = heap_next;
|
42
|
+
heap_next = heap[idx];
|
43
|
+
|
44
|
+
heap[idx] = obj;
|
45
|
+
return idx;
|
46
|
+
}
|
47
|
+
|
39
48
|
function dropObject(idx) {
|
40
49
|
if (idx < 36) return;
|
41
50
|
heap[idx] = heap_next;
|
@@ -48,15 +57,6 @@ function takeObject(idx) {
|
|
48
57
|
return ret;
|
49
58
|
}
|
50
59
|
|
51
|
-
function addHeapObject(obj) {
|
52
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
53
|
-
const idx = heap_next;
|
54
|
-
heap_next = heap[idx];
|
55
|
-
|
56
|
-
heap[idx] = obj;
|
57
|
-
return idx;
|
58
|
-
}
|
59
|
-
|
60
60
|
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
61
61
|
|
62
62
|
cachedTextDecoder.decode();
|
@@ -328,7 +328,7 @@ function handleError(f, args) {
|
|
328
328
|
function getArrayU8FromWasm0(ptr, len) {
|
329
329
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
330
330
|
}
|
331
|
-
function
|
331
|
+
function __wbg_adapter_220(arg0, arg1, arg2, arg3) {
|
332
332
|
wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h05b8fb12110402b0(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
333
333
|
}
|
334
334
|
|
@@ -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]
|
@@ -1572,13 +1584,13 @@ async function load(module, imports) {
|
|
1572
1584
|
function getImports() {
|
1573
1585
|
const imports = {};
|
1574
1586
|
imports.wbg = {};
|
1575
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
1576
|
-
takeObject(arg0);
|
1577
|
-
};
|
1578
1587
|
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
1579
1588
|
const ret = getObject(arg0);
|
1580
1589
|
return addHeapObject(ret);
|
1581
1590
|
};
|
1591
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
1592
|
+
takeObject(arg0);
|
1593
|
+
};
|
1582
1594
|
imports.wbg.__wbindgen_is_object = function(arg0) {
|
1583
1595
|
const val = getObject(arg0);
|
1584
1596
|
const ret = typeof(val) === 'object' && val !== null;
|
@@ -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);
|
@@ -1708,22 +1720,6 @@ function getImports() {
|
|
1708
1720
|
const ret = new Uint8Array(getObject(arg0));
|
1709
1721
|
return addHeapObject(ret);
|
1710
1722
|
};
|
1711
|
-
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1712
|
-
const ret = new Map();
|
1713
|
-
return addHeapObject(ret);
|
1714
|
-
};
|
1715
|
-
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1716
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1717
|
-
return addHeapObject(ret);
|
1718
|
-
};
|
1719
|
-
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1720
|
-
const ret = new Array();
|
1721
|
-
return addHeapObject(ret);
|
1722
|
-
};
|
1723
|
-
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1724
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
1725
|
-
return ret;
|
1726
|
-
};
|
1727
1723
|
imports.wbg.__wbg_new_9962f939219f1820 = function(arg0, arg1) {
|
1728
1724
|
try {
|
1729
1725
|
var state0 = {a: arg0, b: arg1};
|
@@ -1731,7 +1727,7 @@ function getImports() {
|
|
1731
1727
|
const a = state0.a;
|
1732
1728
|
state0.a = 0;
|
1733
1729
|
try {
|
1734
|
-
return
|
1730
|
+
return __wbg_adapter_220(a, state0.b, arg0, arg1);
|
1735
1731
|
} finally {
|
1736
1732
|
state0.a = a;
|
1737
1733
|
}
|
@@ -1742,9 +1738,25 @@ function getImports() {
|
|
1742
1738
|
state0.a = state0.b = 0;
|
1743
1739
|
}
|
1744
1740
|
};
|
1741
|
+
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1742
|
+
const ret = new Array();
|
1743
|
+
return addHeapObject(ret);
|
1744
|
+
};
|
1745
1745
|
imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
|
1746
1746
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
1747
1747
|
};
|
1748
|
+
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1749
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
1750
|
+
return ret;
|
1751
|
+
};
|
1752
|
+
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1753
|
+
const ret = new Map();
|
1754
|
+
return addHeapObject(ret);
|
1755
|
+
};
|
1756
|
+
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1757
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1758
|
+
return addHeapObject(ret);
|
1759
|
+
};
|
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,13 +1824,39 @@ function getImports() {
|
|
1812
1824
|
const ret = false;
|
1813
1825
|
return ret;
|
1814
1826
|
};
|
1827
|
+
imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
|
1828
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
|
1829
|
+
return addHeapObject(ret);
|
1830
|
+
}, arguments) };
|
1831
|
+
imports.wbg.__wbg_open_c5d5fb2df44b9d10 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1832
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
1833
|
+
return addHeapObject(ret);
|
1834
|
+
}, arguments) };
|
1835
|
+
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1836
|
+
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1837
|
+
};
|
1815
1838
|
imports.wbg.__wbg_setonsuccess_5f71593bc51653a3 = function(arg0, arg1) {
|
1816
1839
|
getObject(arg0).onsuccess = getObject(arg1);
|
1817
1840
|
};
|
1841
|
+
imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
|
1842
|
+
getObject(arg0).onerror = getObject(arg1);
|
1843
|
+
};
|
1818
1844
|
imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
|
1819
1845
|
const ret = getObject(arg0).delete(getObject(arg1));
|
1820
1846
|
return addHeapObject(ret);
|
1821
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) };
|
1822
1860
|
imports.wbg.__wbg_put_84e7fc93eee27b28 = function() { return handleError(function (arg0, arg1, arg2) {
|
1823
1861
|
const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
|
1824
1862
|
return addHeapObject(ret);
|
@@ -1835,28 +1873,6 @@ function getImports() {
|
|
1835
1873
|
const ret = getObject(arg0).openCursor();
|
1836
1874
|
return addHeapObject(ret);
|
1837
1875
|
}, arguments) };
|
1838
|
-
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1839
|
-
const ret = getObject(arg0).get(getObject(arg1));
|
1840
|
-
return addHeapObject(ret);
|
1841
|
-
}, arguments) };
|
1842
|
-
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1843
|
-
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1844
|
-
return addHeapObject(ret);
|
1845
|
-
}, arguments) };
|
1846
|
-
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1847
|
-
getObject(arg0).close();
|
1848
|
-
};
|
1849
|
-
imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
|
1850
|
-
getObject(arg0).onerror = getObject(arg1);
|
1851
|
-
};
|
1852
|
-
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1853
|
-
const ret = getObject(arg0).count();
|
1854
|
-
return addHeapObject(ret);
|
1855
|
-
}, arguments) };
|
1856
|
-
imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
|
1857
|
-
const ret = getObject(arg0).count(getObject(arg1));
|
1858
|
-
return addHeapObject(ret);
|
1859
|
-
}, arguments) };
|
1860
1876
|
imports.wbg.__wbg_index_86861edf1478f49c = function() { return handleError(function (arg0, arg1, arg2) {
|
1861
1877
|
const ret = getObject(arg0).index(getStringFromWasm0(arg1, arg2));
|
1862
1878
|
return addHeapObject(ret);
|
@@ -1877,16 +1893,12 @@ function getImports() {
|
|
1877
1893
|
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1878
1894
|
return addHeapObject(ret);
|
1879
1895
|
}, arguments) };
|
1880
|
-
imports.wbg.
|
1881
|
-
const ret = getObject(arg0).
|
1882
|
-
return addHeapObject(ret);
|
1883
|
-
}, arguments) };
|
1884
|
-
imports.wbg.__wbg_open_c5d5fb2df44b9d10 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1885
|
-
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
1896
|
+
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1897
|
+
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1886
1898
|
return addHeapObject(ret);
|
1887
1899
|
}, arguments) };
|
1888
|
-
imports.wbg.
|
1889
|
-
getObject(arg0).
|
1900
|
+
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1901
|
+
getObject(arg0).close();
|
1890
1902
|
};
|
1891
1903
|
imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
|
1892
1904
|
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
@@ -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.
|
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.
|
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-
|
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
|
Binary file
|