@wireapp/core 24.3.1 → 24.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +3 -3
- package/src/main/Account.d.ts +1 -1
- package/src/main/Account.js +6 -6
- package/src/main/client/ClientService.d.ts +1 -1
- package/src/main/client/ClientService.js +2 -2
- package/src/main/cryptography/CryptographyService.d.ts +1 -1
- package/src/main/cryptography/CryptographyService.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [24.4.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.3.1...@wireapp/core@24.4.0) (2022-03-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **core:** updating entropy types ([#4240](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4240)) ([722b6da](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/722b6da8056c1b1524e2db8d5f86f9bfccffb7e0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [24.3.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.3.0...@wireapp/core@24.3.1) (2022-03-21)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"@types/long": "4.0.1",
|
|
7
7
|
"@types/node": "~14",
|
|
8
8
|
"@wireapp/api-client": "18.5.1",
|
|
9
|
-
"@wireapp/cryptobox": "12.
|
|
9
|
+
"@wireapp/cryptobox": "12.8.0",
|
|
10
10
|
"bazinga64": "5.10.0",
|
|
11
11
|
"hash.js": "1.1.7",
|
|
12
12
|
"http-status-codes": "2.1.4",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"test:project": "yarn dist && yarn test",
|
|
70
70
|
"test:node": "nyc jasmine --config=jasmine.json"
|
|
71
71
|
},
|
|
72
|
-
"version": "24.
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"version": "24.4.0",
|
|
73
|
+
"gitHead": "1ff01d1490b4cc23342006255bc07181334c541f"
|
|
74
74
|
}
|
package/src/main/Account.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare class Account extends EventEmitter {
|
|
|
87
87
|
init(clientType: ClientType, cookie?: Cookie, initializedStoreEngine?: CRUDEngine): Promise<Context>;
|
|
88
88
|
initServices(storeEngine: CRUDEngine): Promise<void>;
|
|
89
89
|
login(loginData: LoginData, initClient?: boolean, clientInfo?: ClientInfo, initializedStoreEngine?: CRUDEngine): Promise<Context>;
|
|
90
|
-
initClient(loginData: LoginData, clientInfo?: ClientInfo): Promise<{
|
|
90
|
+
initClient(loginData: LoginData, clientInfo?: ClientInfo, entropyData?: Uint8Array): Promise<{
|
|
91
91
|
isNewClient: boolean;
|
|
92
92
|
localClient: RegisteredClient;
|
|
93
93
|
}>;
|
package/src/main/Account.js
CHANGED
|
@@ -201,7 +201,7 @@ class Account extends events_1.EventEmitter {
|
|
|
201
201
|
}
|
|
202
202
|
return context;
|
|
203
203
|
}
|
|
204
|
-
async initClient(loginData, clientInfo) {
|
|
204
|
+
async initClient(loginData, clientInfo, entropyData) {
|
|
205
205
|
var _a, _b;
|
|
206
206
|
if (!this.service) {
|
|
207
207
|
throw new Error('Services are not set.');
|
|
@@ -219,7 +219,7 @@ class Account extends events_1.EventEmitter {
|
|
|
219
219
|
const notFoundOnBackend = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === http_status_codes_1.StatusCodes.NOT_FOUND;
|
|
220
220
|
if (notFoundInDatabase) {
|
|
221
221
|
this.logger.log(`Could not find valid client in database "${(_b = this.storeEngine) === null || _b === void 0 ? void 0 : _b.storeName}".`);
|
|
222
|
-
return this.registerClient(loginData, clientInfo);
|
|
222
|
+
return this.registerClient(loginData, clientInfo, entropyData);
|
|
223
223
|
}
|
|
224
224
|
if (notFoundOnBackend) {
|
|
225
225
|
this.logger.log('Could not find valid client on backend');
|
|
@@ -232,11 +232,11 @@ class Account extends events_1.EventEmitter {
|
|
|
232
232
|
}
|
|
233
233
|
const context = await this.apiClient.init(loginData.clientType);
|
|
234
234
|
await this.initEngine(context);
|
|
235
|
-
return this.registerClient(loginData, clientInfo);
|
|
235
|
+
return this.registerClient(loginData, clientInfo, entropyData);
|
|
236
236
|
}
|
|
237
237
|
this.logger.log('Last client was permanent - Deleting cryptography stores');
|
|
238
238
|
await this.service.cryptography.deleteCryptographyStores();
|
|
239
|
-
return this.registerClient(loginData, clientInfo);
|
|
239
|
+
return this.registerClient(loginData, clientInfo, entropyData);
|
|
240
240
|
}
|
|
241
241
|
throw error;
|
|
242
242
|
}
|
|
@@ -248,11 +248,11 @@ class Account extends events_1.EventEmitter {
|
|
|
248
248
|
this.apiClient.context.clientId = loadedClient.id;
|
|
249
249
|
return loadedClient;
|
|
250
250
|
}
|
|
251
|
-
async registerClient(loginData, clientInfo) {
|
|
251
|
+
async registerClient(loginData, clientInfo, entropyData) {
|
|
252
252
|
if (!this.service) {
|
|
253
253
|
throw new Error('Services are not set.');
|
|
254
254
|
}
|
|
255
|
-
const registeredClient = await this.service.client.register(loginData, clientInfo);
|
|
255
|
+
const registeredClient = await this.service.client.register(loginData, clientInfo, entropyData);
|
|
256
256
|
this.apiClient.context.clientId = registeredClient.id;
|
|
257
257
|
this.logger.log('Client is created');
|
|
258
258
|
await this.service.notification.initializeNotificationStream();
|
|
@@ -23,5 +23,5 @@ export declare class ClientService {
|
|
|
23
23
|
getLocalClient(): Promise<MetaClient>;
|
|
24
24
|
createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
25
25
|
synchronizeClients(): Promise<MetaClient[]>;
|
|
26
|
-
register(loginData: LoginData, clientInfo?: ClientInfo): Promise<RegisteredClient>;
|
|
26
|
+
register(loginData: LoginData, clientInfo?: ClientInfo, entropyData?: Uint8Array): Promise<RegisteredClient>;
|
|
27
27
|
}
|
|
@@ -52,14 +52,14 @@ class ClientService {
|
|
|
52
52
|
classification: client_1.ClientClassification.DESKTOP,
|
|
53
53
|
cookieLabel: 'default',
|
|
54
54
|
model: '@wireapp/core',
|
|
55
|
-
}) {
|
|
55
|
+
}, entropyData) {
|
|
56
56
|
if (!this.apiClient.context) {
|
|
57
57
|
throw new Error('Context is not set.');
|
|
58
58
|
}
|
|
59
59
|
if (loginData.clientType === client_1.ClientType.NONE) {
|
|
60
60
|
throw new Error(`Can't register client of type "${client_1.ClientType.NONE}"`);
|
|
61
61
|
}
|
|
62
|
-
const serializedPreKeys = await this.cryptographyService.createCryptobox();
|
|
62
|
+
const serializedPreKeys = await this.cryptographyService.createCryptobox(entropyData);
|
|
63
63
|
if (!this.cryptographyService.cryptobox.lastResortPreKey) {
|
|
64
64
|
throw new Error('Cryptobox got initialized without a last resort PreKey.');
|
|
65
65
|
}
|
|
@@ -26,7 +26,7 @@ export declare class CryptographyService {
|
|
|
26
26
|
constructSessionId(userId: string | QualifiedId, clientId: string, domain?: string): string;
|
|
27
27
|
static convertArrayRecipientsToBase64(recipients: OTRRecipients<Uint8Array>): OTRRecipients<string>;
|
|
28
28
|
static convertBase64RecipientsToArray(recipients: OTRRecipients<string>): OTRRecipients<Uint8Array>;
|
|
29
|
-
createCryptobox(): Promise<SerializedPreKey[]>;
|
|
29
|
+
createCryptobox(entropyData?: Uint8Array): Promise<SerializedPreKey[]>;
|
|
30
30
|
decrypt(sessionId: string, encodedCiphertext: string): Promise<Uint8Array>;
|
|
31
31
|
encryptQualified(plainText: Uint8Array, preKeyBundles: QualifiedUserPreKeyBundleMap | QualifiedUserClients): Promise<{
|
|
32
32
|
missing: QualifiedUserClients;
|
|
@@ -64,8 +64,8 @@ class CryptographyService {
|
|
|
64
64
|
return [userId, otrClientMapWithUint8Array];
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
|
-
async createCryptobox() {
|
|
68
|
-
const initialPreKeys = await this.cryptobox.create();
|
|
67
|
+
async createCryptobox(entropyData) {
|
|
68
|
+
const initialPreKeys = await this.cryptobox.create(entropyData);
|
|
69
69
|
return initialPreKeys
|
|
70
70
|
.map(preKey => {
|
|
71
71
|
const preKeyJson = this.cryptobox.serialize_prekey(preKey);
|