@wireapp/core 34.1.2 → 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,15 +3,15 @@
3
3
  "./src/main/cryptography/AssetCryptography/crypto.node": "./src/main/cryptography/AssetCryptography/crypto.browser.js"
4
4
  },
5
5
  "dependencies": {
6
- "@wireapp/api-client": "^21.0.4",
7
- "@wireapp/commons": "^4.4.10",
6
+ "@wireapp/api-client": "^21.0.5",
7
+ "@wireapp/commons": "^4.5.0",
8
8
  "@wireapp/core-crypto": "0.5.2",
9
9
  "@wireapp/cryptobox": "12.8.0",
10
- "@wireapp/promise-queue": "^1.3.4",
11
- "@wireapp/protocol-messaging": "1.39.0",
12
- "@wireapp/store-engine-dexie": "^1.7.11",
10
+ "@wireapp/promise-queue": "^1.3.5",
11
+ "@wireapp/protocol-messaging": "^1.39.0",
12
+ "@wireapp/store-engine-dexie": "^1.7.12",
13
13
  "axios": "1.1.2",
14
- "bazinga64": "5.11.10",
14
+ "bazinga64": "5.11.11",
15
15
  "hash.js": "1.1.7",
16
16
  "http-status-codes": "2.2.0",
17
17
  "idb": "7.1.0",
@@ -24,19 +24,18 @@
24
24
  "@babel/preset-env": "^7.19.1",
25
25
  "@babel/preset-typescript": "^7.18.6",
26
26
  "@faker-js/faker": "^7.6.0",
27
+ "@swc/core": "^1.3.10",
28
+ "@swc/jest": "^0.2.23",
27
29
  "@types/babel__core": "^7",
28
- "@types/jest": "29.2.0",
30
+ "@types/jest": "^29.2.0",
29
31
  "@types/long": "4.0.1",
30
- "@types/node": "^18.11.2",
31
32
  "@types/tough-cookie": "4.0.2",
32
33
  "@wireapp/commons": "workspace:^",
33
34
  "@wireapp/store-engine-dexie": "workspace:^",
34
35
  "commander": "9.4.1",
35
36
  "cross-env": "7.0.3",
36
37
  "dotenv-defaults": "5.0.2",
37
- "fake-indexeddb": "4.0.0",
38
- "jest": "29.2.1",
39
- "jest-jasmine2": "29.2.1",
38
+ "jest": "^29.2.1",
40
39
  "jest-websocket-mock": "2.4.0",
41
40
  "mock-socket": "9.1.5",
42
41
  "nock": "13.2.9"
@@ -62,8 +61,9 @@
62
61
  "start:echo": "cross-env NODE_DEBUG='@wireapp/core*' node src/demo/echo.js",
63
62
  "start:sender": "cross-env NODE_DEBUG='@wireapp/core*' node src/demo/sender.js",
64
63
  "test": "jest",
65
- "watch": "tsc ---watch"
64
+ "test:coverage": "jest --coverage",
65
+ "watch": "tsc --watch"
66
66
  },
67
- "version": "34.1.2",
68
- "gitHead": "b16406e772a8e137de37fbfae5d9f63339d2489c"
67
+ "version": "34.1.4",
68
+ "gitHead": "20dbda642036995c302830288c6f317cd38749f5"
69
69
  }
@@ -2,16 +2,19 @@ import { AddProposalArgs, ConversationConfiguration, ConversationId, CoreCrypto,
2
2
  import { APIClient } from '@wireapp/api-client';
3
3
  import { QualifiedUsers } from '../../conversation';
4
4
  import { MLSCallbacks, MLSConfig } from '../types';
5
+ import { PostMlsMessageResponse } from '@wireapp/api-client/src/conversation';
6
+ import logdown from 'logdown';
5
7
  export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
6
8
  export declare class MLSService {
7
9
  readonly config: MLSConfig | undefined;
8
10
  private readonly apiClient;
9
11
  private readonly coreCryptoClientProvider;
12
+ logger: logdown.Logger;
10
13
  groupIdFromConversationId?: MLSCallbacks['groupIdFromConversationId'];
11
14
  constructor(config: MLSConfig | undefined, apiClient: APIClient, coreCryptoClientProvider: () => CoreCrypto | undefined);
12
15
  private get coreCryptoClient();
13
16
  private uploadCommitBundle;
14
- addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<import("@wireapp/api-client/src/conversation").PostMlsMessageResponse | null>;
17
+ addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse | null>;
15
18
  configureMLSCallbacks({ groupIdFromConversationId, ...coreCryptoCallbacks }: MLSCallbacks): void;
16
19
  getKeyPackagesPayload(qualifiedUsers: QualifiedUsers[]): Promise<Invitee[]>;
17
20
  getEpoch(groupId: Uint8Array): Promise<number>;
@@ -31,9 +34,9 @@ export declare class MLSService {
31
34
  * @param generateCommit The function that will generate a coreCrypto CommitBundle
32
35
  */
33
36
  private processCommitAction;
34
- updateKeyingMaterial(conversationId: ConversationId): Promise<import("@wireapp/api-client/src/conversation").PostMlsMessageResponse | null>;
37
+ updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse | null>;
35
38
  createConversation(conversationId: ConversationId, configuration?: ConversationConfiguration): Promise<any>;
36
- removeClientsFromConversation(conversationId: ConversationId, clientIds: Uint8Array[]): Promise<import("@wireapp/api-client/src/conversation").PostMlsMessageResponse | null>;
39
+ removeClientsFromConversation(conversationId: ConversationId, clientIds: Uint8Array[]): Promise<PostMlsMessageResponse | null>;
37
40
  commitPendingProposals(groupId: ConversationId): Promise<void>;
38
41
  conversationExists(conversationId: ConversationId): Promise<boolean>;
39
42
  clientValidKeypackagesCount(): Promise<number>;
@@ -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
- await task();
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;