@wireapp/core 38.13.0 → 38.13.1
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 +4 -6
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +3 -25
- package/lib/messagingProtocols/mls/types.d.ts +10 -6
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{CoreCryptoWrapper.d.ts → CoreCryptoWrapper/CoreCryptoWrapper.d.ts} +10 -4
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{CoreCryptoWrapper.js → CoreCryptoWrapper/CoreCryptoWrapper.js} +31 -4
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.d.ts +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.js +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.store.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.store.js +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.test.d.ts +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/PrekeysTracker.test.js +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/index.d.ts +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/index.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper/PrekeysTracker}/index.js +0 -0
- package/lib/{util → messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper}/encryptedStore.d.ts +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/encryptedStore.d.ts.map +1 -0
- package/lib/{util → messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper}/encryptedStore.js +0 -0
- package/lib/{util → messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper}/encryptedStore.test.node.d.ts +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/encryptedStore.test.node.d.ts.map +1 -0
- package/lib/{util → messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper}/encryptedStore.test.node.js +0 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/index.d.ts +2 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/{PrekeysTracker → CoreCryptoWrapper}/index.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/index.js +35 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.d.ts +13 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.js +83 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.test.d.ts +2 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.test.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.test.js +118 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +4 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +3 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +1 -1
- package/package.json +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.store.d.ts.map +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.d.ts.map +0 -1
- package/lib/util/encryptedStore.d.ts.map +0 -1
- package/lib/util/encryptedStore.test.node.d.ts.map +0 -1
package/lib/Account.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare enum ConnectionState {
|
|
|
37
37
|
LIVE = "live"
|
|
38
38
|
}
|
|
39
39
|
export type CreateStoreFn = (storeName: string, context: Context) => undefined | Promise<CRUDEngine | undefined>;
|
|
40
|
-
interface AccountOptions
|
|
40
|
+
interface AccountOptions {
|
|
41
41
|
/** Used to store info in the database (will create a inMemory engine if returns undefined) */
|
|
42
42
|
createStore?: CreateStoreFn;
|
|
43
43
|
/** Number of prekeys to generate when creating a new device (defaults to 2)
|
|
@@ -53,7 +53,7 @@ interface AccountOptions<T> {
|
|
|
53
53
|
/**
|
|
54
54
|
* Config for MLS and proteus devices. Will fallback to the old proteus logic if not provided
|
|
55
55
|
*/
|
|
56
|
-
cryptoProtocolConfig?: CryptoProtocolConfig
|
|
56
|
+
cryptoProtocolConfig?: CryptoProtocolConfig;
|
|
57
57
|
}
|
|
58
58
|
type InitOptions = {
|
|
59
59
|
/** cookie used to identify the current user. Will use the browser cookie if not defined */
|
|
@@ -62,13 +62,12 @@ type InitOptions = {
|
|
|
62
62
|
type Events = {
|
|
63
63
|
[EVENTS.NEW_SESSION]: NewClient;
|
|
64
64
|
};
|
|
65
|
-
export declare class Account
|
|
65
|
+
export declare class Account extends TypedEventEmitter<Events> {
|
|
66
66
|
private readonly apiClient;
|
|
67
67
|
private readonly logger;
|
|
68
68
|
private readonly createStore;
|
|
69
69
|
private storeEngine?;
|
|
70
70
|
private db?;
|
|
71
|
-
private secretsDb?;
|
|
72
71
|
private readonly nbPrekeys;
|
|
73
72
|
private readonly cryptoProtocolConfig?;
|
|
74
73
|
service?: {
|
|
@@ -92,7 +91,7 @@ export declare class Account<T = any> extends TypedEventEmitter<Events> {
|
|
|
92
91
|
* @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
|
|
93
92
|
* @param accountOptions
|
|
94
93
|
*/
|
|
95
|
-
constructor(apiClient?: APIClient, { createStore, nbPrekeys, cryptoProtocolConfig }?: AccountOptions
|
|
94
|
+
constructor(apiClient?: APIClient, { createStore, nbPrekeys, cryptoProtocolConfig }?: AccountOptions);
|
|
96
95
|
/**
|
|
97
96
|
* Will set the APIClient to use a specific version of the API (by default uses version 0)
|
|
98
97
|
* It will fetch the API Config and use the highest possible version
|
|
@@ -138,7 +137,6 @@ export declare class Account<T = any> extends TypedEventEmitter<Events> {
|
|
|
138
137
|
* @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
|
|
139
138
|
*/
|
|
140
139
|
initClient(client?: RegisteredClient): Promise<RegisteredClient | undefined>;
|
|
141
|
-
private generateSecretKey;
|
|
142
140
|
private buildCryptoClient;
|
|
143
141
|
/**
|
|
144
142
|
* 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,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,YAAY,EAAE,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAC,M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54
54
|
const CoreDB_1 = require("./storage/CoreDB");
|
|
55
55
|
const team_1 = require("./team/");
|
|
56
56
|
const user_1 = require("./user/");
|
|
57
|
-
const encryptedStore_1 = require("./util/encryptedStore");
|
|
58
57
|
const TypedEventEmitter_1 = require("./util/TypedEventEmitter");
|
|
59
58
|
var EVENTS;
|
|
60
59
|
(function (EVENTS) {
|
|
@@ -219,36 +218,16 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
219
218
|
}
|
|
220
219
|
return validClient;
|
|
221
220
|
}
|
|
222
|
-
async generateSecretKey(baseDbName) {
|
|
223
|
-
var _a, _b;
|
|
224
|
-
const coreCryptoKeyId = 'corecrypto-key';
|
|
225
|
-
const dbName = `secrets-${baseDbName}`;
|
|
226
|
-
const systemCrypto = (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.systemCrypto;
|
|
227
|
-
this.secretsDb = systemCrypto
|
|
228
|
-
? await (0, encryptedStore_1.createCustomEncryptedStore)(dbName, systemCrypto)
|
|
229
|
-
: await (0, encryptedStore_1.createEncryptedStore)(dbName);
|
|
230
|
-
let key = await this.secretsDb.getsecretValue(coreCryptoKeyId);
|
|
231
|
-
if (!key) {
|
|
232
|
-
key = crypto.getRandomValues(new Uint8Array(16));
|
|
233
|
-
await this.secretsDb.saveSecretValue(coreCryptoKeyId, key);
|
|
234
|
-
}
|
|
235
|
-
await ((_b = this.secretsDb) === null || _b === void 0 ? void 0 : _b.close());
|
|
236
|
-
return key;
|
|
237
|
-
}
|
|
238
221
|
async buildCryptoClient(context, storeEngine, db, enableMLS) {
|
|
239
|
-
var _a, _b;
|
|
222
|
+
var _a, _b, _c;
|
|
240
223
|
const clientType = enableMLS || !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.useCoreCrypto)
|
|
241
224
|
? CryptoClient_1.CryptoClientType.CORE_CRYPTO
|
|
242
225
|
: CryptoClient_1.CryptoClientType.CRYPTOBOX;
|
|
243
|
-
let key = Uint8Array.from([]);
|
|
244
|
-
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO) {
|
|
245
|
-
key = await this.generateSecretKey(storeEngine.storeName);
|
|
246
|
-
}
|
|
247
226
|
return (0, CryptoClient_1.buildCryptoClient)(clientType, db, {
|
|
248
227
|
storeEngine,
|
|
249
|
-
secretKey: key,
|
|
250
228
|
nbPrekeys: this.nbPrekeys,
|
|
251
229
|
coreCryptoWasmFilePath: (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.coreCrypoWasmFilePath,
|
|
230
|
+
systemCrypto: (_c = this.cryptoProtocolConfig) === null || _c === void 0 ? void 0 : _c.systemCrypto,
|
|
252
231
|
onNewPrekeys: async (prekeys) => {
|
|
253
232
|
this.logger.debug(`Received '${prekeys.length}' new PreKeys.`);
|
|
254
233
|
await this.apiClient.api.client.putClient(context.clientId, { prekeys });
|
|
@@ -333,9 +312,8 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
|
|
|
333
312
|
* Will delete the identity of the current user
|
|
334
313
|
*/
|
|
335
314
|
async wipe() {
|
|
336
|
-
var _a
|
|
315
|
+
var _a;
|
|
337
316
|
await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.proteus.wipe(this.storeEngine));
|
|
338
|
-
await ((_b = this.secretsDb) === null || _b === void 0 ? void 0 : _b.wipe());
|
|
339
317
|
if (this.db) {
|
|
340
318
|
await (0, CoreDB_1.deleteDB)(this.db);
|
|
341
319
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { Conversation, ConversationProtocol } from '@wireapp/api-client/lib/conversation';
|
|
2
2
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
3
3
|
import { CoreCryptoCallbacks } from '@wireapp/core-crypto';
|
|
4
|
-
type SecretCrypto
|
|
5
|
-
encrypt: (value: Uint8Array) => Promise<
|
|
6
|
-
decrypt: (payload:
|
|
4
|
+
export type SecretCrypto = {
|
|
5
|
+
encrypt: (value: Uint8Array) => Promise<Uint8Array>;
|
|
6
|
+
decrypt: (payload: Uint8Array) => Promise<Uint8Array>;
|
|
7
|
+
version: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
encrypt: (value: string) => Promise<Uint8Array>;
|
|
10
|
+
decrypt: (payload: Uint8Array) => Promise<string>;
|
|
11
|
+
version: 1;
|
|
7
12
|
};
|
|
8
13
|
export interface MLSCallbacks extends Pick<CoreCryptoCallbacks, 'authorize' | 'userAuthorize'> {
|
|
9
14
|
/**
|
|
@@ -24,12 +29,12 @@ export type HandlePendingProposalsParams = {
|
|
|
24
29
|
export type CommitPendingProposalsParams = {
|
|
25
30
|
skipDelete?: boolean;
|
|
26
31
|
} & CommonMLS;
|
|
27
|
-
export interface CryptoProtocolConfig
|
|
32
|
+
export interface CryptoProtocolConfig {
|
|
28
33
|
/**
|
|
29
34
|
* encrypt/decrypt function pair that will be called before storing/fetching secrets in the secrets database.
|
|
30
35
|
* If not provided will use the built in encryption mechanism
|
|
31
36
|
*/
|
|
32
|
-
systemCrypto?: SecretCrypto
|
|
37
|
+
systemCrypto?: SecretCrypto;
|
|
33
38
|
useCoreCrypto?: boolean;
|
|
34
39
|
/**
|
|
35
40
|
* path on the public server to the core crypto wasm file.
|
|
@@ -52,5 +57,4 @@ export type MLSConversation = Conversation & {
|
|
|
52
57
|
epoch: number;
|
|
53
58
|
group_id: string;
|
|
54
59
|
};
|
|
55
|
-
export {};
|
|
56
60
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceR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AAC;IAExB;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B,uEAAuE;IACvE,GAAG,CAAC,EAAE;QACJ;;WAEG;QACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;KACxC,CAAC;IAEF,oKAAoK;IACpK,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG;IAC3C,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,17 +1,23 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
4
|
+
import { CoreDatabase } from '../../../../../storage/CoreDB';
|
|
5
|
+
import { SecretCrypto } from '../../../../mls/types';
|
|
6
|
+
import { CryptoClient } from '../CryptoClient.types';
|
|
6
7
|
type Config = {
|
|
8
|
+
systemCrypto?: SecretCrypto;
|
|
7
9
|
nbPrekeys: number;
|
|
8
10
|
onNewPrekeys: (prekeys: PreKey[]) => void;
|
|
9
11
|
};
|
|
10
|
-
|
|
12
|
+
type ClientConfig = Config & {
|
|
13
|
+
onWipe: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export declare function buildClient(storeEngine: CRUDEngine, coreCryptoWasmFilePath: string, db: CoreDatabase, { systemCrypto, nbPrekeys, onNewPrekeys }: Config): Promise<CoreCryptoWrapper>;
|
|
11
16
|
export declare class CoreCryptoWrapper implements CryptoClient {
|
|
12
17
|
private readonly coreCrypto;
|
|
18
|
+
private readonly config;
|
|
13
19
|
private readonly prekeyTracker;
|
|
14
|
-
constructor(coreCrypto: CoreCrypto, db: CoreDatabase, config:
|
|
20
|
+
constructor(coreCrypto: CoreCrypto, db: CoreDatabase, config: ClientConfig);
|
|
15
21
|
getNativeClient(): CoreCrypto;
|
|
16
22
|
encrypt(sessions: string[], plainText: Uint8Array): Promise<Map<string, Uint8Array>>;
|
|
17
23
|
decrypt(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
|
|
@@ -0,0 +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,+BAA+B,CAAC;AAC3D,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,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,GAAG;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AAEF,wBAAsB,WAAW,CAC/B,WAAW,EAAE,UAAU,EACvB,sBAAsB,EAAE,MAAM,EAC9B,EAAE,EAAE,YAAY,EAChB,EAAC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAC,EAAE,MAAM,GAC9C,OAAO,CAAC,iBAAiB,CAAC,CA4B5B;AAED,qBAAa,iBAAkB,YAAW,YAAY;IAGxC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAAgC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAF9F,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAEjB,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAmB,MAAM,EAAE,YAAY;IAI5G,eAAe;IAIf,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU;IAIjD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAI9C,IAAI;IAIE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;;;;;;;IAsBpD,cAAc;IAId,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAIhC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAK/D,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAIvD,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,WAAW,CAAC,SAAS,EAAE,MAAM;IAI7B,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,aAAa;IAIP,SAAS,CAAC,EAAE,EAAE,MAAM;;;;IAKpB,iBAAiB,CAAC,SAAS,EAAE,MAAM;IAUnC,kBAAkB;IAIlB,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAInC,IAAI;CAIX"}
|
|
@@ -20,20 +20,46 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.CoreCryptoWrapper = exports.buildClient = void 0;
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
|
+
const idb_1 = require("idb");
|
|
23
24
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
24
25
|
const PrekeysTracker_1 = require("./PrekeysTracker");
|
|
25
|
-
|
|
26
|
+
const secretKeyGenerator_1 = require("./secretKeyGenerator");
|
|
27
|
+
async function buildClient(storeEngine, coreCryptoWasmFilePath, db, { systemCrypto, nbPrekeys, onNewPrekeys }) {
|
|
28
|
+
let key;
|
|
29
|
+
const coreCryptoDbName = `corecrypto-${storeEngine.storeName}`;
|
|
30
|
+
const secretKeysDbName = `secrets-${storeEngine.storeName}`;
|
|
31
|
+
try {
|
|
32
|
+
key = await (0, secretKeyGenerator_1.generateSecretKey)({
|
|
33
|
+
dbName: secretKeysDbName,
|
|
34
|
+
systemCrypto,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error instanceof secretKeyGenerator_1.CorruptedKeyError) {
|
|
39
|
+
// If we are dealing with a corrupted key, we wipe the key and the coreCrypto DB to start fresh
|
|
40
|
+
await (0, idb_1.deleteDB)(secretKeysDbName);
|
|
41
|
+
await (0, idb_1.deleteDB)(coreCryptoDbName);
|
|
42
|
+
key = await (0, secretKeyGenerator_1.generateSecretKey)({
|
|
43
|
+
dbName: secretKeysDbName,
|
|
44
|
+
systemCrypto,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
26
51
|
const coreCrypto = await core_crypto_1.CoreCrypto.deferredInit({
|
|
27
|
-
databaseName:
|
|
28
|
-
key: bazinga64_1.Encoder.toBase64(
|
|
52
|
+
databaseName: coreCryptoDbName,
|
|
53
|
+
key: bazinga64_1.Encoder.toBase64(key.key).asString,
|
|
29
54
|
wasmFilePath: coreCryptoWasmFilePath,
|
|
30
55
|
});
|
|
31
|
-
return new CoreCryptoWrapper(coreCrypto, db, { nbPrekeys, onNewPrekeys });
|
|
56
|
+
return new CoreCryptoWrapper(coreCrypto, db, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
32
57
|
}
|
|
33
58
|
exports.buildClient = buildClient;
|
|
34
59
|
class CoreCryptoWrapper {
|
|
35
60
|
constructor(coreCrypto, db, config) {
|
|
36
61
|
this.coreCrypto = coreCrypto;
|
|
62
|
+
this.config = config;
|
|
37
63
|
this.prekeyTracker = new PrekeysTracker_1.PrekeyTracker(this, db, config);
|
|
38
64
|
}
|
|
39
65
|
getNativeClient() {
|
|
@@ -111,6 +137,7 @@ class CoreCryptoWrapper {
|
|
|
111
137
|
return this.coreCrypto.proteusCryptoboxMigrate(dbName);
|
|
112
138
|
}
|
|
113
139
|
async wipe() {
|
|
140
|
+
await this.config.onWipe();
|
|
114
141
|
return this.coreCrypto.wipe();
|
|
115
142
|
}
|
|
116
143
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
2
|
-
import { CryptoClient } from '
|
|
3
|
-
import type { CoreDatabase } from '
|
|
2
|
+
import { CryptoClient } from '../..';
|
|
3
|
+
import type { CoreDatabase } from '../../../../../../storage/CoreDB';
|
|
4
4
|
type CoreCryptoPrekeyGenerator = Pick<CryptoClient, 'newPrekey'>;
|
|
5
5
|
interface PrekeysGeneratorConfig {
|
|
6
6
|
/**
|
|
@@ -0,0 +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;AACnC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAEnE,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;IAItB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAE1B,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,WAAW,CAAsB;gBAGtB,SAAS,EAAE,yBAAyB,EACrD,EAAE,EAAE,YAAY,EACR,MAAM,EAAE,sBAAsB;YAK1B,eAAe;IASvB,aAAa;IAUb,eAAe,CAAC,gBAAgB,EAAE,MAAM;IAI9C,OAAO,CAAC,sBAAsB;CAK/B"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrekeysTracker.store.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAQ9D,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;YAE/B,QAAQ;YAIR,SAAS;IAIvB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAOhC,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAK3C;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMlD"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrekeysTracker.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.ts"],"names":[],"mappings":""}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const PrekeysTracker_1 = require("./PrekeysTracker");
|
|
22
|
-
const CoreDB_1 = require("
|
|
22
|
+
const CoreDB_1 = require("../../../../../../storage/CoreDB");
|
|
23
23
|
describe('PrekeysGenerator', () => {
|
|
24
24
|
let db;
|
|
25
25
|
const baseConfig = {
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryptedStore.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/encryptedStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAmB,MAAM,KAAK,CAAC;AAE7D,UAAU,uBAAuB;IAC/B,EAAE,EAAE,UAAU,GAAG,WAAW,CAAC;IAC7B,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;CACjC;AACD,UAAU,WAAW,CAAC,gBAAgB,CAAE,SAAQ,QAAQ;IACtD,GAAG,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,gBAAgB,CAAC;KACzB,CAAC;CACH;AAED,KAAK,SAAS,CAAC,gBAAgB,IAAI,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AACtF,KAAK,SAAS,CAAC,gBAAgB,IAAI,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEpF,KAAK,oBAAoB,CAAC,gBAAgB,IAAI;IAC5C,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACrC,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACtC,CAAC;AAEF,qBAAa,cAAc,CAAC,gBAAgB;;IAIxC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,EAChE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC;IAMtD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IAKrD,cAAc,CAAC,UAAU,EAAE,MAAM;IAQjC,KAAK;IAIL,IAAI;CAIX;AAuBD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,CAkB3G;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,gBAAgB,EAC/D,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAQ3C"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryptedStore.test.node.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/encryptedStore.test.node.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/index.ts"],"names":[],"mappings":"AAmBA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./CoreCryptoWrapper"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SecretCrypto } from '../../../../mls/types';
|
|
2
|
+
export declare class CorruptedKeyError extends Error {
|
|
3
|
+
}
|
|
4
|
+
type GeneratedKey = {
|
|
5
|
+
key: Uint8Array;
|
|
6
|
+
deleteKey: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateSecretKey({ dbName, systemCrypto: baseCrypto, }: {
|
|
9
|
+
dbName: string;
|
|
10
|
+
systemCrypto?: SecretCrypto;
|
|
11
|
+
}): Promise<GeneratedKey>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=secretKeyGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secretKeyGenerator.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAKnD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,YAAY,EAAE,UAAU,GACzB,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GAAG,OAAO,CAAC,YAAY,CAAC,CAwDxB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.generateSecretKey = exports.CorruptedKeyError = void 0;
|
|
22
|
+
const bazinga64_1 = require("bazinga64");
|
|
23
|
+
const encryptedStore_1 = require("./encryptedStore");
|
|
24
|
+
const isBase64 = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/;
|
|
25
|
+
const KEY_SIZE = 16;
|
|
26
|
+
class CorruptedKeyError extends Error {
|
|
27
|
+
}
|
|
28
|
+
exports.CorruptedKeyError = CorruptedKeyError;
|
|
29
|
+
async function generateSecretKey({ dbName, systemCrypto: baseCrypto, }) {
|
|
30
|
+
const coreCryptoKeyId = 'corecrypto-key';
|
|
31
|
+
const systemCrypto = baseCrypto
|
|
32
|
+
? {
|
|
33
|
+
encrypt: (value) => {
|
|
34
|
+
if (baseCrypto.version === 1) {
|
|
35
|
+
const strValue = bazinga64_1.Encoder.toBase64(value).asString;
|
|
36
|
+
return baseCrypto.encrypt(strValue);
|
|
37
|
+
}
|
|
38
|
+
// In previous versions of the systemCrypto (prior to February 2023), encrypt took a uint8Array
|
|
39
|
+
return baseCrypto.encrypt(value);
|
|
40
|
+
},
|
|
41
|
+
decrypt: async (value) => {
|
|
42
|
+
if (typeof baseCrypto.version === 'undefined') {
|
|
43
|
+
// In previous versions of the systemCrypto (prior to February 2023), the decrypt function returned a Uint8Array
|
|
44
|
+
return baseCrypto.decrypt(value);
|
|
45
|
+
}
|
|
46
|
+
const decrypted = await baseCrypto.decrypt(value);
|
|
47
|
+
if (isBase64.test(decrypted)) {
|
|
48
|
+
return bazinga64_1.Decoder.fromBase64(decrypted).asBytes;
|
|
49
|
+
}
|
|
50
|
+
// Between June 2022 and October 2022, the systemCrypto returned a string encoded in UTF-8
|
|
51
|
+
const encoder = new TextEncoder();
|
|
52
|
+
return encoder.encode(decrypted);
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
: undefined;
|
|
56
|
+
const secretsDb = systemCrypto
|
|
57
|
+
? await (0, encryptedStore_1.createCustomEncryptedStore)(dbName, systemCrypto)
|
|
58
|
+
: await (0, encryptedStore_1.createEncryptedStore)(dbName);
|
|
59
|
+
try {
|
|
60
|
+
let key;
|
|
61
|
+
try {
|
|
62
|
+
key = await secretsDb.getsecretValue(coreCryptoKeyId);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw new CorruptedKeyError('Could not decrypt key');
|
|
66
|
+
}
|
|
67
|
+
if (key && key.length !== KEY_SIZE) {
|
|
68
|
+
// If the key size is not correct, we have a corrupted key in the DB. This is unrecoverable.
|
|
69
|
+
throw new CorruptedKeyError('Invalid key');
|
|
70
|
+
}
|
|
71
|
+
if (!key) {
|
|
72
|
+
key = crypto.getRandomValues(new Uint8Array(KEY_SIZE));
|
|
73
|
+
await secretsDb.saveSecretValue(coreCryptoKeyId, key);
|
|
74
|
+
}
|
|
75
|
+
await (secretsDb === null || secretsDb === void 0 ? void 0 : secretsDb.close());
|
|
76
|
+
return { key, deleteKey: () => secretsDb.wipe() };
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
await (secretsDb === null || secretsDb === void 0 ? void 0 : secretsDb.close());
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.generateSecretKey = generateSecretKey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secretKeyGenerator.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/secretKeyGenerator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const bazinga64_1 = require("bazinga64");
|
|
22
|
+
const secretKeyGenerator_1 = require("./secretKeyGenerator");
|
|
23
|
+
const systemCryptos = {
|
|
24
|
+
v0: {
|
|
25
|
+
encrypt: async (value) => {
|
|
26
|
+
return value;
|
|
27
|
+
},
|
|
28
|
+
decrypt: async (value) => {
|
|
29
|
+
return value;
|
|
30
|
+
},
|
|
31
|
+
version: undefined,
|
|
32
|
+
},
|
|
33
|
+
v01: {
|
|
34
|
+
encrypt: async (value) => {
|
|
35
|
+
return bazinga64_1.Encoder.toBase64(value).asBytes;
|
|
36
|
+
},
|
|
37
|
+
decrypt: async (value) => {
|
|
38
|
+
const str = new TextDecoder().decode(value);
|
|
39
|
+
return bazinga64_1.Decoder.fromBase64(str).asBytes;
|
|
40
|
+
},
|
|
41
|
+
version: undefined,
|
|
42
|
+
},
|
|
43
|
+
v1: {
|
|
44
|
+
encrypt: async (value) => {
|
|
45
|
+
const encoder = new TextEncoder();
|
|
46
|
+
return encoder.encode(value);
|
|
47
|
+
},
|
|
48
|
+
decrypt: async (value) => {
|
|
49
|
+
const decoder = new TextDecoder();
|
|
50
|
+
return decoder.decode(value);
|
|
51
|
+
},
|
|
52
|
+
version: 1,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const dbName = 'test';
|
|
56
|
+
describe('SecretKeyGenerator', () => {
|
|
57
|
+
beforeEach(async () => {
|
|
58
|
+
return new Promise(resolve => {
|
|
59
|
+
Object.values(systemCryptos).forEach(version => {
|
|
60
|
+
jest.spyOn(version, 'encrypt');
|
|
61
|
+
jest.spyOn(version, 'decrypt');
|
|
62
|
+
});
|
|
63
|
+
const deleteReq = indexedDB.deleteDatabase(dbName);
|
|
64
|
+
deleteReq.onsuccess = resolve;
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('generates and store a secret key stored in indexeddb', async () => {
|
|
68
|
+
const { key: secretKey } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName });
|
|
69
|
+
expect(secretKey).toBeDefined();
|
|
70
|
+
const { key: secretKey2 } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName });
|
|
71
|
+
expect(secretKey).toEqual(secretKey2);
|
|
72
|
+
});
|
|
73
|
+
it.each(Object.entries(systemCryptos))('generates and store a secret key encrypted using system crypto (%s)', async (_name, systemCrypto) => {
|
|
74
|
+
const { key } = await (0, secretKeyGenerator_1.generateSecretKey)({
|
|
75
|
+
dbName,
|
|
76
|
+
systemCrypto,
|
|
77
|
+
});
|
|
78
|
+
expect(key).toBeDefined();
|
|
79
|
+
expect(systemCrypto.encrypt).toHaveBeenCalled();
|
|
80
|
+
expect(systemCrypto.decrypt).not.toHaveBeenCalled();
|
|
81
|
+
// fetch stored key
|
|
82
|
+
const { key: key2 } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName, systemCrypto: systemCrypto });
|
|
83
|
+
expect(key2).toEqual(key);
|
|
84
|
+
expect(systemCrypto.encrypt).toHaveBeenCalledTimes(1);
|
|
85
|
+
expect(systemCrypto.decrypt).toHaveBeenCalledTimes(1);
|
|
86
|
+
});
|
|
87
|
+
it.each([
|
|
88
|
+
['v0 > v01', systemCryptos.v0, systemCryptos.v01],
|
|
89
|
+
['v0 > v1', systemCryptos.v0, systemCryptos.v1],
|
|
90
|
+
])('throws an error if previous systemCrypto is not compatible with the current one (%s)', async (_name, crypto1, crypto2) => {
|
|
91
|
+
const { key } = await (0, secretKeyGenerator_1.generateSecretKey)({
|
|
92
|
+
dbName,
|
|
93
|
+
systemCrypto: crypto1,
|
|
94
|
+
});
|
|
95
|
+
expect(key).toBeDefined();
|
|
96
|
+
try {
|
|
97
|
+
await (0, secretKeyGenerator_1.generateSecretKey)({ dbName, systemCrypto: crypto2 });
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
expect(e).toBeInstanceOf(secretKeyGenerator_1.CorruptedKeyError);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
it('deletes the key from DB', async () => {
|
|
104
|
+
const { key, deleteKey } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName });
|
|
105
|
+
await deleteKey();
|
|
106
|
+
const { key: secondKey } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName: 'test' });
|
|
107
|
+
expect(key).not.toEqual(secondKey);
|
|
108
|
+
});
|
|
109
|
+
it.each([['v01 > v1', systemCryptos.v01, systemCryptos.v1]])('is able to read a key that was generated with a previous system crypto (%s)', async (_name, crypto1, crypto2) => {
|
|
110
|
+
const { key } = await (0, secretKeyGenerator_1.generateSecretKey)({
|
|
111
|
+
dbName: 'test',
|
|
112
|
+
systemCrypto: crypto1,
|
|
113
|
+
});
|
|
114
|
+
expect(key).toBeDefined();
|
|
115
|
+
const { key: key2 } = await (0, secretKeyGenerator_1.generateSecretKey)({ dbName: 'test', systemCrypto: crypto2 });
|
|
116
|
+
expect(key2).toEqual(key);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
2
2
|
import type { CRUDEngine } from '@wireapp/store-engine';
|
|
3
|
-
import type { CoreCryptoWrapper } from './CoreCryptoWrapper';
|
|
3
|
+
import type { CoreCryptoWrapper } from './CoreCryptoWrapper/CoreCryptoWrapper';
|
|
4
4
|
import type { CryptoboxWrapper } from './CryptoboxWrapper';
|
|
5
5
|
import { CoreDatabase } from '../../../../storage/CoreDB';
|
|
6
|
+
import { SecretCrypto } from '../../../mls/types';
|
|
6
7
|
export declare enum CryptoClientType {
|
|
7
8
|
CORE_CRYPTO = 0,
|
|
8
9
|
CRYPTOBOX = 1
|
|
@@ -14,9 +15,9 @@ type WrapConfig = {
|
|
|
14
15
|
};
|
|
15
16
|
type InitConfig = WrapConfig & {
|
|
16
17
|
storeEngine: CRUDEngine;
|
|
17
|
-
|
|
18
|
+
systemCrypto?: SecretCrypto;
|
|
18
19
|
coreCryptoWasmFilePath?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare function buildCryptoClient(clientType: CryptoClientType, db: CoreDatabase, { storeEngine, nbPrekeys,
|
|
21
|
+
export declare function buildCryptoClient(clientType: CryptoClientType, db: CoreDatabase, { storeEngine, nbPrekeys, systemCrypto, coreCryptoWasmFilePath, onNewPrekeys }: InitConfig): Promise<CryptoClientDef>;
|
|
21
22
|
export {};
|
|
22
23
|
//# 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,
|
|
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,4BAA4B,CAAC;AACxD,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,EAAE,EAAE,YAAY,EAChB,EAAC,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,YAAY,EAAC,EAAE,UAAU,GACvF,OAAO,CAAC,eAAe,CAAC,CAc1B"}
|
|
@@ -47,10 +47,11 @@ 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, db, { storeEngine, nbPrekeys,
|
|
50
|
+
async function buildCryptoClient(clientType, db, { 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,
|
|
53
|
+
const client = await buildClient(storeEngine, coreCryptoWasmFilePath !== null && coreCryptoWasmFilePath !== void 0 ? coreCryptoWasmFilePath : '', db, {
|
|
54
|
+
systemCrypto,
|
|
54
55
|
nbPrekeys,
|
|
55
56
|
onNewPrekeys,
|
|
56
57
|
});
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.buildProteusService = void 0;
|
|
22
22
|
const client_1 = require("@wireapp/api-client/lib/client");
|
|
23
23
|
const api_client_1 = require("@wireapp/api-client");
|
|
24
|
-
const CoreCryptoWrapper_1 = require("./CryptoClient/CoreCryptoWrapper");
|
|
24
|
+
const CoreCryptoWrapper_1 = require("./CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper");
|
|
25
25
|
const ProteusService_1 = require("./ProteusService");
|
|
26
26
|
const PayloadHelper_1 = require("../../../test/PayloadHelper");
|
|
27
27
|
const buildProteusService = async (federated = false) => {
|
|
@@ -51,7 +51,7 @@ const SessionHandler_1 = require("../Utility/SessionHandler");
|
|
|
51
51
|
const notification_1 = require("../../../notification");
|
|
52
52
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
53
53
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
54
|
-
jest.mock('./CryptoClient/PrekeysTracker', () => {
|
|
54
|
+
jest.mock('./CryptoClient/CoreCryptoWrapper/PrekeysTracker', () => {
|
|
55
55
|
return {
|
|
56
56
|
PrekeyTracker: jest.fn().mockImplementation(() => {
|
|
57
57
|
return {
|
package/package.json
CHANGED
package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts.map
DELETED
|
@@ -1 +0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B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAK/D,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAIvD,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,WAAW,CAAC,SAAS,EAAE,MAAM;IAI7B,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,aAAa;IAIP,SAAS,CAAC,EAAE,EAAE,MAAM;;;;IAKpB,iBAAiB,CAAC,SAAS,EAAE,MAAM;IAUnC,kBAAkB;IAIlB,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAInC,IAAI;CAGX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrekeysTracker.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,YAAY,EAAC,MAAM,IAAI,CAAC;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAEhE,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;IAItB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAE1B,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,WAAW,CAAsB;gBAGtB,SAAS,EAAE,yBAAyB,EACrD,EAAE,EAAE,YAAY,EACR,MAAM,EAAE,sBAAsB;YAK1B,eAAe;IASvB,aAAa;IAUb,eAAe,CAAC,gBAAgB,EAAE,MAAM;IAI9C,OAAO,CAAC,sBAAsB;CAK/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrekeysTracker.store.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.store.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAQ3D,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;YAE/B,QAAQ;YAIR,SAAS;IAIvB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAOhC,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAK3C;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrekeysTracker.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryptedStore.d.ts","sourceRoot":"","sources":["../../src/util/encryptedStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAmB,MAAM,KAAK,CAAC;AAE7D,UAAU,uBAAuB;IAC/B,EAAE,EAAE,UAAU,GAAG,WAAW,CAAC;IAC7B,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;CACjC;AACD,UAAU,WAAW,CAAC,gBAAgB,CAAE,SAAQ,QAAQ;IACtD,GAAG,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,gBAAgB,CAAC;KACzB,CAAC;CACH;AAED,KAAK,SAAS,C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