@wireapp/core 34.1.3 → 34.1.4
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
|
@@ -3,11 +3,13 @@ import { APIClient } from '@wireapp/api-client';
|
|
|
3
3
|
import { QualifiedUsers } from '../../conversation';
|
|
4
4
|
import { MLSCallbacks, MLSConfig } from '../types';
|
|
5
5
|
import { PostMlsMessageResponse } from '@wireapp/api-client/src/conversation';
|
|
6
|
+
import logdown from 'logdown';
|
|
6
7
|
export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
|
|
7
8
|
export declare class MLSService {
|
|
8
9
|
readonly config: MLSConfig | undefined;
|
|
9
10
|
private readonly apiClient;
|
|
10
11
|
private readonly coreCryptoClientProvider;
|
|
12
|
+
logger: logdown.Logger;
|
|
11
13
|
groupIdFromConversationId?: MLSCallbacks['groupIdFromConversationId'];
|
|
12
14
|
constructor(config: MLSConfig | undefined, apiClient: APIClient, coreCryptoClientProvider: () => CoreCrypto | undefined);
|
|
13
15
|
private get coreCryptoClient();
|
|
@@ -28,11 +28,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
+
};
|
|
31
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
35
|
exports.MLSService = exports.optionalToUint8Array = void 0;
|
|
33
36
|
const bazinga64_1 = require("bazinga64");
|
|
34
37
|
const messageSender_1 = require("../../conversation/message/messageSender");
|
|
35
38
|
const fullyQualifiedClientIdUtils_1 = require("../../util/fullyQualifiedClientIdUtils");
|
|
39
|
+
const logdown_1 = __importDefault(require("logdown"));
|
|
36
40
|
//@todo: this function is temporary, we wait for the update from core-crypto side
|
|
37
41
|
//they are returning regular array instead of Uint8Array for commit and welcome messages
|
|
38
42
|
const optionalToUint8Array = (array) => {
|
|
@@ -44,6 +48,7 @@ class MLSService {
|
|
|
44
48
|
this.config = config;
|
|
45
49
|
this.apiClient = apiClient;
|
|
46
50
|
this.coreCryptoClientProvider = coreCryptoClientProvider;
|
|
51
|
+
this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
|
|
47
52
|
}
|
|
48
53
|
get coreCryptoClient() {
|
|
49
54
|
const client = this.coreCryptoClientProvider();
|
|
@@ -59,6 +64,9 @@ class MLSService {
|
|
|
59
64
|
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
60
65
|
(0, exports.optionalToUint8Array)(commit));
|
|
61
66
|
await this.coreCryptoClient.commitAccepted(groupId);
|
|
67
|
+
const newEpoch = await this.getEpoch(groupId);
|
|
68
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
69
|
+
this.logger.log(`Commit have been accepted for group "${groupIdStr}". New epoch is "${newEpoch}"`);
|
|
62
70
|
if (welcome) {
|
|
63
71
|
// If the commit went well, we can send the Welcome
|
|
64
72
|
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
@@ -82,7 +90,7 @@ class MLSService {
|
|
|
82
90
|
const { user } = (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(decoder.decode(client));
|
|
83
91
|
return otherClients.some(client => {
|
|
84
92
|
const { user: otherUser } = (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(decoder.decode(client));
|
|
85
|
-
return otherUser === user;
|
|
93
|
+
return otherUser.toLowerCase() === user.toLowerCase();
|
|
86
94
|
});
|
|
87
95
|
} }));
|
|
88
96
|
this.groupIdFromConversationId = groupIdFromConversationId;
|
|
@@ -43,8 +43,9 @@ const addTask = ({ task, firingDate, key }) => {
|
|
|
43
43
|
cancelTask(key);
|
|
44
44
|
}
|
|
45
45
|
const timeout = setTimeout(async () => {
|
|
46
|
-
|
|
46
|
+
logger.info(`Executing task with key "${key}"`);
|
|
47
47
|
delete activeTimeouts[key];
|
|
48
|
+
await task();
|
|
48
49
|
}, delay > 0 ? delay : 0);
|
|
49
50
|
// add the task to the list of active tasks
|
|
50
51
|
activeTimeouts[key] = timeout;
|