@wireapp/core 39.2.3 → 39.2.5
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/lib/Account.d.ts +1 -1
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +4 -11
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +4 -5
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +12 -10
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +8 -9
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts +4 -9
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +10 -24
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.js +2 -10
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +4 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +1 -1
- package/package.json +4 -4
package/lib/Account.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
137
137
|
*
|
|
138
138
|
* @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
|
|
139
139
|
*/
|
|
140
|
-
initClient(client
|
|
140
|
+
initClient(client: RegisteredClient): Promise<RegisteredClient>;
|
|
141
141
|
private buildCryptoClient;
|
|
142
142
|
/**
|
|
143
143
|
* In order to be able to send MLS messages, the core needs a few information from the consumer.
|
package/lib/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACnG,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAOxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,g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G;QACH,4BAA4B,CAAC,EAAE,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;QAEtF;;WAEG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
|
package/lib/Account.js
CHANGED
|
@@ -178,7 +178,6 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
178
178
|
// we reset the services to re-instantiate a new CryptoClient instance
|
|
179
179
|
await this.initServices(this.apiClient.context);
|
|
180
180
|
const initialPreKeys = await this.service.proteus.createClient(entropyData);
|
|
181
|
-
await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
|
|
182
181
|
const client = await this.service.client.register(loginData, clientInfo, initialPreKeys);
|
|
183
182
|
if (this.service.mls) {
|
|
184
183
|
const { userId, domain = '' } = this.apiClient.context;
|
|
@@ -187,14 +186,8 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
187
186
|
this.logger.info(`Created new client {mls: ${!!this.service.mls}, id: ${client.id}}`);
|
|
188
187
|
await this.service.notification.initializeNotificationStream();
|
|
189
188
|
await this.service.client.synchronizeClients();
|
|
190
|
-
|
|
191
|
-
return client;
|
|
189
|
+
return this.initClient(client);
|
|
192
190
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Will initiate all the cryptographic material of the device and setup all the background tasks.
|
|
195
|
-
*
|
|
196
|
-
* @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
|
|
197
|
-
*/
|
|
198
191
|
async initClient(client) {
|
|
199
192
|
if (!this.service || !this.apiClient.context || !this.storeEngine) {
|
|
200
193
|
throw new Error('Services are not set.');
|
|
@@ -224,7 +217,7 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
224
217
|
}
|
|
225
218
|
return validClient;
|
|
226
219
|
}
|
|
227
|
-
async buildCryptoClient(context, storeEngine,
|
|
220
|
+
async buildCryptoClient(context, storeEngine, enableMLS) {
|
|
228
221
|
var _a, _b, _c;
|
|
229
222
|
/* There are 3 cases where we want to instantiate CoreCrypto:
|
|
230
223
|
* 1. MLS is enabled
|
|
@@ -236,7 +229,7 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
236
229
|
cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.isReady(storeEngine.storeName)
|
|
237
230
|
? CryptoClient_1.CryptoClientType.CORE_CRYPTO
|
|
238
231
|
: CryptoClient_1.CryptoClientType.CRYPTOBOX;
|
|
239
|
-
return (0, CryptoClient_1.buildCryptoClient)(clientType,
|
|
232
|
+
return (0, CryptoClient_1.buildCryptoClient)(clientType, {
|
|
240
233
|
storeEngine,
|
|
241
234
|
nbPrekeys: this.nbPrekeys,
|
|
242
235
|
coreCryptoWasmFilePath: (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.coreCrypoWasmFilePath,
|
|
@@ -266,7 +259,7 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
266
259
|
this.db = await (0, CoreDB_1.openDB)(this.generateCoreDbName(context));
|
|
267
260
|
const accountService = new account_1.AccountService(this.apiClient);
|
|
268
261
|
const assetService = new conversation_1.AssetService(this.apiClient);
|
|
269
|
-
const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine,
|
|
262
|
+
const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine, enableMLS);
|
|
270
263
|
const [clientType, cryptoClient] = cryptoClientDef;
|
|
271
264
|
const mlsService = clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && enableMLS
|
|
272
265
|
? new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), Object.assign(Object.assign({}, (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.mls), { nbKeyPackages: this.nbPrekeys }))
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
2
2
|
import { CoreCrypto } from '@wireapp/core-crypto';
|
|
3
3
|
import type { CRUDEngine } from '@wireapp/store-engine';
|
|
4
|
-
import { CoreDatabase } from '../../../../../storage/CoreDB';
|
|
5
4
|
import { SecretCrypto } from '../../../../mls/types';
|
|
6
5
|
import { CryptoClient } from '../CryptoClient.types';
|
|
7
6
|
type Config = {
|
|
@@ -12,16 +11,16 @@ type Config = {
|
|
|
12
11
|
type ClientConfig = Config & {
|
|
13
12
|
onWipe: () => Promise<void>;
|
|
14
13
|
};
|
|
15
|
-
export declare function buildClient(storeEngine: CRUDEngine, coreCryptoWasmFilePath: string,
|
|
14
|
+
export declare function buildClient(storeEngine: CRUDEngine, coreCryptoWasmFilePath: string, { systemCrypto, nbPrekeys, onNewPrekeys }: Config): Promise<CoreCryptoWrapper>;
|
|
16
15
|
export declare class CoreCryptoWrapper implements CryptoClient {
|
|
17
16
|
private readonly coreCrypto;
|
|
18
17
|
private readonly config;
|
|
19
18
|
private readonly prekeyTracker;
|
|
20
|
-
constructor(coreCrypto: CoreCrypto,
|
|
19
|
+
constructor(coreCrypto: CoreCrypto, config: ClientConfig);
|
|
21
20
|
getNativeClient(): CoreCrypto;
|
|
22
21
|
encrypt(sessions: string[], plainText: Uint8Array): Promise<Map<string, Uint8Array>>;
|
|
23
22
|
decrypt(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
|
|
24
|
-
init(): Promise<void>;
|
|
23
|
+
init(nbInitialPrekeys?: number): Promise<void>;
|
|
25
24
|
create(nbPrekeys: number, entropy?: Uint8Array): Promise<{
|
|
26
25
|
prekeys: PreKey[];
|
|
27
26
|
lastPrekey: {
|
|
@@ -37,7 +36,7 @@ export declare class CoreCryptoWrapper implements CryptoClient {
|
|
|
37
36
|
saveSession(sessionId: string): Promise<void>;
|
|
38
37
|
deleteSession(sessionId: string): Promise<void>;
|
|
39
38
|
consumePrekey(): Promise<void>;
|
|
40
|
-
newPrekey(
|
|
39
|
+
newPrekey(): Promise<{
|
|
41
40
|
id: number;
|
|
42
41
|
key: string;
|
|
43
42
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKtD,OAAO,EAAC,YAAY,EAAC,MAAM
|
|
1
|
+
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKtD,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,KAAK,MAAM,GAAG;IACZ,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAA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24
24
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
25
25
|
const PrekeysTracker_1 = require("./PrekeysTracker");
|
|
26
26
|
const secretKeyGenerator_1 = require("./secretKeyGenerator");
|
|
27
|
-
async function buildClient(storeEngine, coreCryptoWasmFilePath,
|
|
27
|
+
async function buildClient(storeEngine, coreCryptoWasmFilePath, { systemCrypto, nbPrekeys, onNewPrekeys }) {
|
|
28
28
|
let key;
|
|
29
29
|
const coreCryptoDbName = `corecrypto-${storeEngine.storeName}`;
|
|
30
30
|
const secretKeysDbName = `secrets-${storeEngine.storeName}`;
|
|
@@ -53,14 +53,14 @@ async function buildClient(storeEngine, coreCryptoWasmFilePath, db, { systemCryp
|
|
|
53
53
|
key: bazinga64_1.Encoder.toBase64(key.key).asString,
|
|
54
54
|
wasmFilePath: coreCryptoWasmFilePath,
|
|
55
55
|
});
|
|
56
|
-
return new CoreCryptoWrapper(coreCrypto,
|
|
56
|
+
return new CoreCryptoWrapper(coreCrypto, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
57
57
|
}
|
|
58
58
|
exports.buildClient = buildClient;
|
|
59
59
|
class CoreCryptoWrapper {
|
|
60
|
-
constructor(coreCrypto,
|
|
60
|
+
constructor(coreCrypto, config) {
|
|
61
61
|
this.coreCrypto = coreCrypto;
|
|
62
62
|
this.config = config;
|
|
63
|
-
this.prekeyTracker = new PrekeysTracker_1.PrekeyTracker(this,
|
|
63
|
+
this.prekeyTracker = new PrekeysTracker_1.PrekeyTracker(this, config);
|
|
64
64
|
}
|
|
65
65
|
getNativeClient() {
|
|
66
66
|
return this.coreCrypto;
|
|
@@ -71,7 +71,10 @@ class CoreCryptoWrapper {
|
|
|
71
71
|
decrypt(sessionId, message) {
|
|
72
72
|
return this.coreCrypto.proteusDecrypt(sessionId, message);
|
|
73
73
|
}
|
|
74
|
-
init() {
|
|
74
|
+
init(nbInitialPrekeys) {
|
|
75
|
+
if (nbInitialPrekeys) {
|
|
76
|
+
this.prekeyTracker.setInitialState(nbInitialPrekeys);
|
|
77
|
+
}
|
|
75
78
|
return this.coreCrypto.proteusInit();
|
|
76
79
|
}
|
|
77
80
|
async create(nbPrekeys, entropy) {
|
|
@@ -81,9 +84,8 @@ class CoreCryptoWrapper {
|
|
|
81
84
|
await this.init();
|
|
82
85
|
const prekeys = [];
|
|
83
86
|
for (let id = 0; id < nbPrekeys; id++) {
|
|
84
|
-
prekeys.push(await this.newPrekey(
|
|
87
|
+
prekeys.push(await this.newPrekey());
|
|
85
88
|
}
|
|
86
|
-
await this.prekeyTracker.setInitialState(prekeys.length);
|
|
87
89
|
const lastPrekeyBytes = await this.coreCrypto.proteusLastResortPrekey();
|
|
88
90
|
const lastPrekey = bazinga64_1.Encoder.toBase64(lastPrekeyBytes).asString;
|
|
89
91
|
const lastPrekeyId = core_crypto_1.CoreCrypto.proteusLastResortPrekeyId();
|
|
@@ -117,9 +119,9 @@ class CoreCryptoWrapper {
|
|
|
117
119
|
consumePrekey() {
|
|
118
120
|
return this.prekeyTracker.consumePrekey();
|
|
119
121
|
}
|
|
120
|
-
async newPrekey(
|
|
121
|
-
const
|
|
122
|
-
return { id, key: bazinga64_1.Encoder.toBase64(
|
|
122
|
+
async newPrekey() {
|
|
123
|
+
const { id, pkb } = await this.coreCrypto.proteusNewPrekeyAuto();
|
|
124
|
+
return { id, key: bazinga64_1.Encoder.toBase64(pkb).asString };
|
|
123
125
|
}
|
|
124
126
|
async debugBreakSession(sessionId) {
|
|
125
127
|
const fakePrekey = [
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
2
2
|
import { CryptoClient } from '../..';
|
|
3
|
-
import type { CoreDatabase } from '../../../../../../storage/CoreDB';
|
|
4
3
|
type CoreCryptoPrekeyGenerator = Pick<CryptoClient, 'newPrekey'>;
|
|
5
4
|
interface PrekeysGeneratorConfig {
|
|
6
5
|
/**
|
|
@@ -17,10 +16,10 @@ export declare class PrekeyTracker {
|
|
|
17
16
|
private readonly generator;
|
|
18
17
|
private config;
|
|
19
18
|
private prekeyState;
|
|
20
|
-
constructor(generator: CoreCryptoPrekeyGenerator,
|
|
19
|
+
constructor(generator: CoreCryptoPrekeyGenerator, config: PrekeysGeneratorConfig);
|
|
21
20
|
private generatePrekeys;
|
|
21
|
+
setInitialState(nbPrekeys: number): number;
|
|
22
22
|
consumePrekey(): Promise<void>;
|
|
23
|
-
setInitialState(nbInitialPrekeys: number): Promise<void>;
|
|
24
23
|
private numberOfMissingPrekeys;
|
|
25
24
|
}
|
|
26
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrekeysTracker.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PrekeysTracker.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAEnC,KAAK,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAEjE,UAAU,sBAAsB;IAC9B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C;AAED,qBAAa,aAAa;IAGZ,OAAO,CAAC,QAAQ,CAAC,SAAS;IAA6B,OAAO,CAAC,MAAM;IAFjF,OAAO,CAAC,WAAW,CAAsB;gBAEZ,SAAS,EAAE,yBAAyB,EAAU,MAAM,EAAE,sBAAsB;YAI3F,eAAe;IAQ7B,eAAe,CAAC,SAAS,EAAE,MAAM;IAI3B,aAAa;IAUnB,OAAO,CAAC,sBAAsB;CAK/B"}
|
|
@@ -21,21 +21,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.PrekeyTracker = void 0;
|
|
22
22
|
const PrekeysTracker_store_1 = require("./PrekeysTracker.store");
|
|
23
23
|
class PrekeyTracker {
|
|
24
|
-
constructor(generator,
|
|
24
|
+
constructor(generator, config) {
|
|
25
25
|
this.generator = generator;
|
|
26
26
|
this.config = config;
|
|
27
|
-
this.prekeyState = new PrekeysTracker_store_1.PrekeysTrackerStore(
|
|
27
|
+
this.prekeyState = new PrekeysTracker_store_1.PrekeysTrackerStore();
|
|
28
28
|
}
|
|
29
29
|
async generatePrekeys(nb) {
|
|
30
30
|
const prekeys = [];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
prekeys.push(await this.generator.newPrekey(id));
|
|
31
|
+
for (let i = 0; i < nb; i++) {
|
|
32
|
+
prekeys.push(await this.generator.newPrekey());
|
|
34
33
|
}
|
|
35
34
|
return prekeys;
|
|
36
35
|
}
|
|
36
|
+
setInitialState(nbPrekeys) {
|
|
37
|
+
return this.prekeyState.addPrekeys(nbPrekeys);
|
|
38
|
+
}
|
|
37
39
|
async consumePrekey() {
|
|
38
|
-
const nbPrekeys =
|
|
40
|
+
const nbPrekeys = this.prekeyState.consumePrekey();
|
|
39
41
|
const missingPrekeys = this.numberOfMissingPrekeys(nbPrekeys);
|
|
40
42
|
if (missingPrekeys > 0) {
|
|
41
43
|
// when the number of local prekeys hit less than a quarter of what it should be, we refill the stock
|
|
@@ -43,9 +45,6 @@ class PrekeyTracker {
|
|
|
43
45
|
this.config.onNewPrekeys(newPrekeys);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
async setInitialState(nbInitialPrekeys) {
|
|
47
|
-
await this.prekeyState.createIds(nbInitialPrekeys);
|
|
48
|
-
}
|
|
49
48
|
numberOfMissingPrekeys(currentNumberOfPrekeys) {
|
|
50
49
|
const threshold = Math.ceil(this.config.nbPrekeys / 2);
|
|
51
50
|
const hasHitThreshold = currentNumberOfPrekeys <= threshold;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { CoreDatabase } from '../../../../../../storage/CoreDB';
|
|
2
1
|
export declare class PrekeysTrackerStore {
|
|
3
|
-
private
|
|
4
|
-
constructor(db: CoreDatabase);
|
|
5
|
-
private getState;
|
|
6
|
-
private saveState;
|
|
2
|
+
private setNbPrekeys;
|
|
7
3
|
/**
|
|
8
4
|
* Will mark one prekey as consumed and decrease the total number of prekeys of 1
|
|
9
5
|
* @returns the number of valid prekeys that are left
|
|
10
6
|
*/
|
|
11
|
-
consumePrekey():
|
|
12
|
-
getNumberOfPrekeys(): Promise<number>;
|
|
7
|
+
consumePrekey(): number;
|
|
13
8
|
/**
|
|
14
|
-
*
|
|
9
|
+
* Will add to the number of prekeys that are stored
|
|
15
10
|
* @param nbIds the number of ids to generate
|
|
16
11
|
*/
|
|
17
|
-
|
|
12
|
+
addPrekeys(delta: number): number;
|
|
18
13
|
}
|
|
19
14
|
//# sourceMappingURL=PrekeysTracker.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrekeysTracker.store.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrekeysTracker.store.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.ts"],"names":[],"mappings":"AAyBA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,YAAY;IAMpB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAGlC"}
|
|
@@ -19,40 +19,26 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.PrekeysTrackerStore = void 0;
|
|
22
|
-
|
|
22
|
+
let state = { nbPrekeys: 0 };
|
|
23
23
|
class PrekeysTrackerStore {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _a;
|
|
29
|
-
return (_a = (await this.db.get('prekeys', STATE_PRIMARY_KEY))) !== null && _a !== void 0 ? _a : { nbPrekeys: 0, highestId: 0 };
|
|
30
|
-
}
|
|
31
|
-
async saveState(state) {
|
|
32
|
-
await this.db.put('prekeys', state, STATE_PRIMARY_KEY);
|
|
24
|
+
setNbPrekeys(delta) {
|
|
25
|
+
const newNbPrekeys = state.nbPrekeys + delta;
|
|
26
|
+
state = Object.assign(Object.assign({}, state), { nbPrekeys: newNbPrekeys });
|
|
27
|
+
return newNbPrekeys;
|
|
33
28
|
}
|
|
34
29
|
/**
|
|
35
30
|
* Will mark one prekey as consumed and decrease the total number of prekeys of 1
|
|
36
31
|
* @returns the number of valid prekeys that are left
|
|
37
32
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const newState = Object.assign(Object.assign({}, currentState), { nbPrekeys: currentState.nbPrekeys - 1 });
|
|
41
|
-
await this.saveState(newState);
|
|
42
|
-
return newState.nbPrekeys;
|
|
43
|
-
}
|
|
44
|
-
async getNumberOfPrekeys() {
|
|
45
|
-
const currentState = await this.getState();
|
|
46
|
-
return currentState.nbPrekeys;
|
|
33
|
+
consumePrekey() {
|
|
34
|
+
return this.setNbPrekeys(-1);
|
|
47
35
|
}
|
|
48
36
|
/**
|
|
49
|
-
*
|
|
37
|
+
* Will add to the number of prekeys that are stored
|
|
50
38
|
* @param nbIds the number of ids to generate
|
|
51
39
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.saveState({ nbPrekeys: currentState.highestId + nbIds, highestId: currentState.highestId + nbIds });
|
|
55
|
-
return Array.from(new Array(nbIds)).map((_, i) => currentState.highestId + 1 + i);
|
|
40
|
+
addPrekeys(delta) {
|
|
41
|
+
return this.setNbPrekeys(delta);
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
44
|
exports.PrekeysTrackerStore = PrekeysTrackerStore;
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const PrekeysTracker_1 = require("./PrekeysTracker");
|
|
22
|
-
const CoreDB_1 = require("../../../../../../storage/CoreDB");
|
|
23
22
|
describe('PrekeysGenerator', () => {
|
|
24
|
-
let db;
|
|
25
23
|
const baseConfig = {
|
|
26
24
|
nbPrekeys: 10,
|
|
27
25
|
onNewPrekeys: jest.fn(),
|
|
@@ -29,15 +27,9 @@ describe('PrekeysGenerator', () => {
|
|
|
29
27
|
const mockPrekeyTracker = {
|
|
30
28
|
newPrekey: jest.fn().mockResolvedValue(Uint8Array.from([])),
|
|
31
29
|
};
|
|
32
|
-
beforeEach(async () => {
|
|
33
|
-
db = await (0, CoreDB_1.openDB)('test');
|
|
34
|
-
});
|
|
35
|
-
afterEach(async () => {
|
|
36
|
-
await db.clear('prekeys');
|
|
37
|
-
});
|
|
38
30
|
it('triggers the threshold callback when number of prekeys hits the limit', async () => {
|
|
39
|
-
const prekeyTracker = new PrekeysTracker_1.PrekeyTracker(mockPrekeyTracker,
|
|
40
|
-
|
|
31
|
+
const prekeyTracker = new PrekeysTracker_1.PrekeyTracker(mockPrekeyTracker, baseConfig);
|
|
32
|
+
prekeyTracker.setInitialState(baseConfig.nbPrekeys);
|
|
41
33
|
expect(baseConfig.onNewPrekeys).not.toHaveBeenCalled();
|
|
42
34
|
await prekeyTracker.consumePrekey();
|
|
43
35
|
await prekeyTracker.consumePrekey();
|
|
@@ -2,7 +2,6 @@ import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
|
2
2
|
import type { CRUDEngine } from '@wireapp/store-engine';
|
|
3
3
|
import type { CoreCryptoWrapper } from './CoreCryptoWrapper/CoreCryptoWrapper';
|
|
4
4
|
import type { CryptoboxWrapper } from './CryptoboxWrapper';
|
|
5
|
-
import { CoreDatabase } from '../../../../storage/CoreDB';
|
|
6
5
|
import { SecretCrypto } from '../../../mls/types';
|
|
7
6
|
export declare enum CryptoClientType {
|
|
8
7
|
CORE_CRYPTO = 0,
|
|
@@ -18,6 +17,6 @@ type InitConfig = WrapConfig & {
|
|
|
18
17
|
systemCrypto?: SecretCrypto;
|
|
19
18
|
coreCryptoWasmFilePath?: string;
|
|
20
19
|
};
|
|
21
|
-
export declare function buildCryptoClient(clientType: CryptoClientType,
|
|
20
|
+
export declare function buildCryptoClient(clientType: CryptoClientType, { storeEngine, nbPrekeys, systemCrypto, coreCryptoWasmFilePath, onNewPrekeys }: InitConfig): Promise<CryptoClientDef>;
|
|
22
21
|
export {};
|
|
23
22
|
//# sourceMappingURL=CryptoClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoClient.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAC,YAAY,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"CryptoClient.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,oBAAY,gBAAgB;IAC1B,WAAW,IAAA;IACX,SAAS,IAAA;CACV;AAED,MAAM,MAAM,eAAe,GACvB,CAAC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,GAC9C,CAAC,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAEtD,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,KAAK,UAAU,GAAG,UAAU,GAAG;IAC7B,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,gBAAgB,EAC5B,EAAC,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAC,EAAE,UAAU,GACvF,OAAO,CAAC,eAAe,CAAC,CAc1B"}
|
|
@@ -47,10 +47,10 @@ var CryptoClientType;
|
|
|
47
47
|
CryptoClientType[CryptoClientType["CORE_CRYPTO"] = 0] = "CORE_CRYPTO";
|
|
48
48
|
CryptoClientType[CryptoClientType["CRYPTOBOX"] = 1] = "CRYPTOBOX";
|
|
49
49
|
})(CryptoClientType = exports.CryptoClientType || (exports.CryptoClientType = {}));
|
|
50
|
-
async function buildCryptoClient(clientType,
|
|
50
|
+
async function buildCryptoClient(clientType, { storeEngine, nbPrekeys, systemCrypto, coreCryptoWasmFilePath, onNewPrekeys }) {
|
|
51
51
|
if (clientType === CryptoClientType.CORE_CRYPTO) {
|
|
52
52
|
const { buildClient } = await Promise.resolve().then(() => __importStar(require('./CoreCryptoWrapper')));
|
|
53
|
-
const client = await buildClient(storeEngine, coreCryptoWasmFilePath !== null && coreCryptoWasmFilePath !== void 0 ? coreCryptoWasmFilePath : '',
|
|
53
|
+
const client = await buildClient(storeEngine, coreCryptoWasmFilePath !== null && coreCryptoWasmFilePath !== void 0 ? coreCryptoWasmFilePath : '', {
|
|
54
54
|
systemCrypto,
|
|
55
55
|
nbPrekeys,
|
|
56
56
|
onNewPrekeys,
|
|
@@ -10,7 +10,7 @@ export interface CryptoClient<T = unknown> {
|
|
|
10
10
|
/**
|
|
11
11
|
* Will init an already existing client. The client should already exist in the database. If the client doesn't exist, it needs to be created using the `create` method.
|
|
12
12
|
*/
|
|
13
|
-
init(): Promise<void>;
|
|
13
|
+
init(nbPrekeys: number): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Will create a new client and store it in the database
|
|
16
16
|
*/
|
|
@@ -23,7 +23,7 @@ export interface CryptoClient<T = unknown> {
|
|
|
23
23
|
saveSession(sessionId: string): Promise<void>;
|
|
24
24
|
consumePrekey: () => Promise<void>;
|
|
25
25
|
deleteSession(sessionId: string): Promise<void>;
|
|
26
|
-
newPrekey(
|
|
26
|
+
newPrekey(): Promise<PreKey>;
|
|
27
27
|
debugBreakSession(sessionId: string): void;
|
|
28
28
|
debugResetIdentity(): Promise<void>;
|
|
29
29
|
/**
|
package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,eAAe,IAAI,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAErE;;OAEG;IACH,IAAI,
|
|
1
|
+
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,eAAe,IAAI,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAErE;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChF,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;OAEG;IACH,oBAAoB,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
|
|
@@ -33,7 +33,7 @@ export declare class CryptoboxWrapper implements CryptoClient {
|
|
|
33
33
|
sessionExists(sessionId: string): Promise<boolean>;
|
|
34
34
|
saveSession(): Promise<void>;
|
|
35
35
|
deleteSession(sessionId: string): Promise<void>;
|
|
36
|
-
newPrekey(
|
|
36
|
+
newPrekey(): Promise<{
|
|
37
37
|
id: number;
|
|
38
38
|
key: string;
|
|
39
39
|
}>;
|
package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoboxWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,KAAK,MAAM,GAAG;IACZ,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,wBAAgB,WAAW,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,oBAGxF;AAED,qBAAa,gBAAiB,YAAW,YAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;IAOjE,eAAe;IAIT,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU;IASvD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIxC,IAAI;IAIJ,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;;;;;;;;;;IAkB/C,cAAc;IAId,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAK5C,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAInD,aAAa;IAIb,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAIvD,aAAa,CAAC,SAAS,EAAE,MAAM;IAQ/B,WAAW;IAIX,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,SAAS
|
|
1
|
+
{"version":3,"file":"CryptoboxWrapper.d.ts","sour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
|
|
@@ -97,9 +97,9 @@ class CryptoboxWrapper {
|
|
|
97
97
|
async deleteSession(sessionId) {
|
|
98
98
|
await this.cryptobox.session_delete(sessionId);
|
|
99
99
|
}
|
|
100
|
-
async newPrekey(
|
|
100
|
+
async newPrekey() {
|
|
101
101
|
// CryptoBox is generating prekeys internally
|
|
102
|
-
return { id, key: '' };
|
|
102
|
+
return { id: 0, key: '' };
|
|
103
103
|
}
|
|
104
104
|
async debugBreakSession(sessionId) {
|
|
105
105
|
const session = await this.cryptobox.session_load(sessionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EAEZ,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAI5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,+BAA+B,EAC/B,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA0C,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAE1F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AAWvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,sBAAsB,CAAC;IACjC,wEAAwE;IACxE,QAAQ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AC,EACvB,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;YA6CnC,OAAO;IAuBd,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAQ7C,OAAO,CAClB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,4BAA4B,GAAG,oBAAoB,GAC9D,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU;CAMpC"}
|
|
@@ -55,6 +55,7 @@ class ProteusService {
|
|
|
55
55
|
return handledEvent;
|
|
56
56
|
}
|
|
57
57
|
async initClient(storeEngine, context) {
|
|
58
|
+
var _a;
|
|
58
59
|
const dbName = storeEngine.storeName;
|
|
59
60
|
if (context.domain) {
|
|
60
61
|
// We want sessions to be fully qualified from now on
|
|
@@ -76,7 +77,9 @@ class ProteusService {
|
|
|
76
77
|
this.logger.error('Client was not able to perform DB migration: ', error);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
const backendPrekeys = await this.apiClient.api.client.getClientPreKeys((_a = context.clientId) !== null && _a !== void 0 ? _a : '');
|
|
81
|
+
const totalUsableBackedPrekeys = backendPrekeys.length - 1; // we remove the last resort prekey from the total number of available prekeys
|
|
82
|
+
return this.cryptoClient.init(totalUsableBackedPrekeys);
|
|
80
83
|
}
|
|
81
84
|
createClient(entropy) {
|
|
82
85
|
return this.cryptoClient.create(this.config.nbPrekeys, entropy);
|
|
@@ -31,7 +31,7 @@ const buildProteusService = async () => {
|
|
|
31
31
|
userId: (0, PayloadHelper_1.getUUID)(),
|
|
32
32
|
clientId: (0, PayloadHelper_1.getUUID)(),
|
|
33
33
|
};
|
|
34
|
-
const cryptoClient = new CoreCryptoWrapper_1.CoreCryptoWrapper({}, {}
|
|
34
|
+
const cryptoClient = new CoreCryptoWrapper_1.CoreCryptoWrapper({}, {});
|
|
35
35
|
const proteusService = new ProteusService_1.ProteusService(apiClient, cryptoClient, {
|
|
36
36
|
nbPrekeys: 0,
|
|
37
37
|
});
|
package/package.json
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^23.1
|
|
14
|
+
"@wireapp/api-client": "^23.2.1",
|
|
15
15
|
"@wireapp/commons": "^5.0.4",
|
|
16
|
-
"@wireapp/core-crypto": "0.
|
|
16
|
+
"@wireapp/core-crypto": "0.7.0-rc.3",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/promise-queue": "^2.1.1",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.44.0",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"test:coverage": "jest --coverage",
|
|
61
61
|
"watch": "tsc --watch"
|
|
62
62
|
},
|
|
63
|
-
"version": "39.2.
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"version": "39.2.5",
|
|
64
|
+
"gitHead": "e434e72fedca7d1fcadcce76a45036cda5a1bd8e"
|
|
65
65
|
}
|