@wireapp/core 38.3.3 → 38.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.
Files changed (64) hide show
  1. package/lib/Account.d.ts +1 -1
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +24 -23
  4. package/lib/client/ClientService.d.ts +2 -2
  5. package/lib/client/ClientService.d.ts.map +1 -1
  6. package/lib/conversation/ConversationService/ConversationService.d.ts +3 -2
  7. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  8. package/lib/conversation/ConversationService/ConversationService.js +8 -2
  9. package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
  10. package/lib/messagingProtocols/mls/types.d.ts +1 -0
  11. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  12. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts +40 -0
  13. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts.map +1 -0
  14. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.js +98 -0
  15. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +12 -0
  16. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -0
  17. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +29 -0
  18. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +31 -0
  19. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -0
  20. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.js +22 -0
  21. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +40 -0
  22. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -0
  23. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +108 -0
  24. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.d.ts → CryptoClient/PrekeysTracker/PrekeysTracker.d.ts} +6 -14
  25. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.d.ts.map +1 -0
  26. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.js → CryptoClient/PrekeysTracker/PrekeysTracker.js} +9 -23
  27. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.store.d.ts → CryptoClient/PrekeysTracker/PrekeysTracker.store.d.ts} +3 -3
  28. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -0
  29. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.store.js → CryptoClient/PrekeysTracker/PrekeysTracker.store.js} +3 -3
  30. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.d.ts +2 -0
  31. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.d.ts.map +1 -0
  32. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.test.js → CryptoClient/PrekeysTracker/PrekeysTracker.test.js} +11 -17
  33. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/index.d.ts +2 -0
  34. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/index.d.ts.map +1 -0
  35. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator → CryptoClient/PrekeysTracker}/index.js +1 -1
  36. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.d.ts +3 -0
  37. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.d.ts.map +1 -0
  38. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.js +36 -0
  39. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +1 -1
  40. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +5 -6
  41. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  42. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +39 -60
  43. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +3 -3
  44. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +0 -4
  45. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  46. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +11 -0
  47. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -0
  48. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +53 -0
  49. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +7 -7
  50. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
  51. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +22 -22
  52. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +4 -3
  53. package/lib/notification/NotificationService.d.ts +2 -2
  54. package/lib/notification/NotificationService.d.ts.map +1 -1
  55. package/lib/notification/NotificationService.js +5 -5
  56. package/lib/notification/NotificationService.test.js +4 -4
  57. package/lib/util/encryptedStore.js +1 -1
  58. package/package.json +3 -2
  59. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.d.ts.map +0 -1
  60. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.store.d.ts.map +0 -1
  61. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.test.d.ts +0 -2
  62. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.test.d.ts.map +0 -1
  63. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/index.d.ts +0 -2
  64. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ProteusService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAE9F,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AACD,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAEvE,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GACrD,qBAAqB,GAAG;IACtB,cAAc,EAAE,WAAW,CAAC;IAE5B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,WAAW,GAAG,oBAAoB,CAAC;IACxE,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,cAAc,GAAG,oBAAoB,EAC7C,OAAO,EAAE,OAAO,KACb,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC;CACxC,CAAC;AAEJ,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"ProteusService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAE9F,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AACD,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GACrD,qBAAqB,GAAG;IACtB,cAAc,EAAE,WAAW,CAAC;IAE5B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,WAAW,GAAG,oBAAoB,CAAC;IACxE,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,cAAc,GAAG,oBAAoB,EAC7C,OAAO,EAAE,OAAO,KACb,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC;CACxC,CAAC;AAEJ,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const cryptoMigrationStore: {
2
+ qualifiedSessions: {
3
+ isReady: (dbName: string) => boolean;
4
+ markAsReady: (dbName: string) => void;
5
+ };
6
+ coreCrypto: {
7
+ isReady: (dbName: string) => boolean;
8
+ markAsReady: (dbName: string) => void;
9
+ };
10
+ };
11
+ //# sourceMappingURL=cryptoMigrationStateStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoMigrationStateStore.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,oBAAoB;;0BAPyC,MAAM;8BANJ,MAAM;;;0BAMR,MAAM;8BANJ,MAAM;;CAsBjF,CAAC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 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.cryptoMigrationStore = void 0;
22
+ function getLocalStorage() {
23
+ try {
24
+ return window.localStorage;
25
+ }
26
+ catch (_a) {
27
+ return { setItem: () => { }, getItem: () => { }, removeItem: () => { } };
28
+ }
29
+ }
30
+ const MIGRATION_READY_STATE = '1';
31
+ const getQualifiedSessionsReadyKey = (dbName) => `${dbName}-qualified-sessions-ready`;
32
+ const getCoreCryptoReadyKey = (dbName) => `${dbName}-corecrypto-ready`;
33
+ const markMigrationReady = (getKey) => (dbName) => {
34
+ const key = getKey(dbName);
35
+ const localStorage = getLocalStorage();
36
+ localStorage.setItem(key, MIGRATION_READY_STATE);
37
+ };
38
+ const isMigrationReady = (getKey) => (dbName) => {
39
+ const key = getKey(dbName);
40
+ const localStorage = getLocalStorage();
41
+ const value = localStorage.getItem(key);
42
+ return !!value && value === MIGRATION_READY_STATE;
43
+ };
44
+ exports.cryptoMigrationStore = {
45
+ qualifiedSessions: {
46
+ isReady: isMigrationReady(getQualifiedSessionsReadyKey),
47
+ markAsReady: markMigrationReady(getQualifiedSessionsReadyKey),
48
+ },
49
+ coreCrypto: {
50
+ isReady: isMigrationReady(getCoreCryptoReadyKey),
51
+ markAsReady: markMigrationReady(getCoreCryptoReadyKey),
52
+ },
53
+ };
@@ -1,9 +1,9 @@
1
1
  import { PreKey } from '@wireapp/api-client/lib/auth';
2
2
  import { UserClients } from '@wireapp/api-client/lib/conversation';
3
3
  import { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/lib/user';
4
- import { CoreCrypto } from '@wireapp/core-crypto/platforms/web/corecrypto';
5
4
  import { Logger } from 'logdown';
6
5
  import { APIClient } from '@wireapp/api-client';
6
+ import { CryptoClient } from '../../ProteusService/CryptoClient';
7
7
  interface ConstructSessionIdParams {
8
8
  userId: string | QualifiedId;
9
9
  clientId: string;
@@ -12,32 +12,32 @@ interface ConstructSessionIdParams {
12
12
  }
13
13
  declare const constructSessionId: ({ userId, clientId, useQualifiedIds, domain }: ConstructSessionIdParams) => string;
14
14
  /**
15
- * Will make sure the session is available in coreCrypto
15
+ * Will make sure the session is available in cryptoClient
16
16
  * @param sessionId the session to init
17
17
  */
18
18
  declare const initSession: ({ userId, clientId, initialPrekey }: {
19
19
  userId: QualifiedId;
20
20
  clientId: string;
21
21
  initialPrekey?: PreKey | undefined;
22
- }, { coreCrypto, apiClient }: {
22
+ }, { cryptoClient, apiClient }: {
23
23
  apiClient: APIClient;
24
- coreCrypto: CoreCrypto;
24
+ cryptoClient: CryptoClient;
25
25
  }) => Promise<string>;
26
26
  interface GetSessionsAndClientsFromRecipientsProps {
27
27
  recipients: UserClients | UserPreKeyBundleMap;
28
28
  domain?: string;
29
29
  apiClient: APIClient;
30
- coreCrypto: CoreCrypto;
30
+ cryptoClient: CryptoClient;
31
31
  logger?: Logger;
32
32
  }
33
33
  /**
34
34
  * Will make sure all the sessions need to encrypt for those user/clients pair are set
35
35
  */
36
- declare const initSessions: ({ recipients, domain, apiClient, coreCrypto, logger, }: GetSessionsAndClientsFromRecipientsProps) => Promise<string[]>;
36
+ declare const initSessions: ({ recipients, domain, apiClient, cryptoClient, logger, }: GetSessionsAndClientsFromRecipientsProps) => Promise<string[]>;
37
37
  interface DeleteSessionParams {
38
38
  userId: QualifiedId;
39
39
  clientId: string;
40
- coreCrypto: CoreCrypto;
40
+ cryptoClient: CryptoClient;
41
41
  useQualifiedIds: boolean;
42
42
  }
43
43
  declare function deleteSession(params: DeleteSessionParams): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"SessionHandler.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.ts"],"names":[],"mappings":"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AAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9D;;GAEG;AACH,QAAA,MAAM,sBAAsB,uDAO3B,CAAC;AAEF,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAC,CAAC"}
1
+ {"version":3,"file":"SessionHandler.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK9C,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAE/D,UAAU,wBAAwB;IAChC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,kBAAkB,kDAAiD,wBAAwB,KAAG,MAKnG,CAAC;AA2GF;;;GAGG;AACH,QAAA,MAAM,WAAW;YAC6B,WAAW;cAAY,MAAM;;;eAClC,SAAS;kBAAgB,YAAY;MAC3E,QAAQ,MAAM,CAYhB,CAAC;AAyBF,UAAU,wCAAwC;IAChD,UAAU,EAAE,WAAW,GAAG,mBAAmB,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,QAAA,MAAM,YAAY,6DAMf,wCAAwC,KAAG,QAAQ,MAAM,EAAE,CAgC7D,CAAC;AAEF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B;AACD,iBAAe,aAAa,CAAC,MAAM,EAAE,mBAAmB,iBAGvD;AA+CD,KAAK,iBAAiB,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9D;;GAEG;AACH,QAAA,MAAM,sBAAsB,uDAO3B,CAAC;AAEF,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAC,CAAC"}
@@ -43,19 +43,19 @@ const parseSessionId = (sessionId) => {
43
43
  }
44
44
  return match.groups;
45
45
  };
46
- const createSession = async ({ sessionId, initialPrekey, coreCrypto, apiClient }) => {
46
+ const createSession = async ({ sessionId, initialPrekey, cryptoClient, apiClient, }) => {
47
47
  const { userId, clientId, domain } = parseSessionId(sessionId);
48
48
  const prekey = initialPrekey !== null && initialPrekey !== void 0 ? initialPrekey : (await apiClient.api.user.getClientPreKey({ id: userId, domain: domain !== null && domain !== void 0 ? domain : '' }, clientId)).prekey;
49
49
  const prekeyBuffer = bazinga64_1.Decoder.fromBase64(prekey.key).asBytes;
50
- await coreCrypto.proteusSessionFromPrekey(sessionId, prekeyBuffer);
51
- await coreCrypto.proteusSessionSave(sessionId);
50
+ await cryptoClient.sessionFromPrekey(sessionId, prekeyBuffer);
51
+ await cryptoClient.saveSession(sessionId);
52
52
  };
53
- const createLegacySessions = async ({ userClients, apiClient, coreCrypto, logger, }) => {
53
+ const createLegacySessions = async ({ userClients, apiClient, cryptoClient, logger, }) => {
54
54
  const preKeyBundleMap = await apiClient.api.user.postMultiPreKeyBundles(userClients);
55
55
  const sessions = await createSessionsFromPreKeys({
56
56
  preKeyBundleMap,
57
57
  useQualifiedIds: false,
58
- coreCrypto,
58
+ cryptoClient,
59
59
  logger,
60
60
  });
61
61
  return sessions;
@@ -64,7 +64,7 @@ const createLegacySessions = async ({ userClients, apiClient, coreCrypto, logger
64
64
  * Create sessions for the qualified clients.
65
65
  * @param {userClientMap} map of domain to (map of user IDs to client IDs)
66
66
  */
67
- const createQualifiedSessions = async ({ userClientMap, domain, apiClient, coreCrypto, logger, }) => {
67
+ const createQualifiedSessions = async ({ userClientMap, domain, apiClient, cryptoClient, logger, }) => {
68
68
  const prekeyBundleMap = await apiClient.api.user.postQualifiedMultiPreKeyBundles({ [domain]: userClientMap });
69
69
  const sessions = [];
70
70
  for (const domain in prekeyBundleMap) {
@@ -73,7 +73,7 @@ const createQualifiedSessions = async ({ userClientMap, domain, apiClient, coreC
73
73
  preKeyBundleMap: domainUsers,
74
74
  domain,
75
75
  useQualifiedIds: true,
76
- coreCrypto,
76
+ cryptoClient,
77
77
  logger,
78
78
  });
79
79
  sessions.push(...domainSessions);
@@ -81,18 +81,18 @@ const createQualifiedSessions = async ({ userClientMap, domain, apiClient, coreC
81
81
  return sessions;
82
82
  };
83
83
  /**
84
- * Will make sure the session is available in coreCrypto
84
+ * Will make sure the session is available in cryptoClient
85
85
  * @param sessionId the session to init
86
86
  */
87
- const initSession = async ({ userId, clientId, initialPrekey }, { coreCrypto, apiClient }) => {
87
+ const initSession = async ({ userId, clientId, initialPrekey }, { cryptoClient, apiClient }) => {
88
88
  const sessionId = constructSessionId({ userId, clientId, useQualifiedIds: !!userId.domain });
89
- const sessionExists = await coreCrypto.proteusSessionExists(sessionId);
89
+ const sessionExists = await cryptoClient.sessionExists(sessionId);
90
90
  if (!sessionExists) {
91
91
  await createSession({
92
92
  sessionId,
93
93
  initialPrekey,
94
94
  apiClient: apiClient,
95
- coreCrypto,
95
+ cryptoClient,
96
96
  });
97
97
  }
98
98
  return sessionId;
@@ -103,21 +103,21 @@ exports.initSession = initSession;
103
103
  * Will call createQualifiedSessions or createLegacySessions based on passed userClientMap.
104
104
  * @param {userClientMap} map of domain to (map of user IDs to client IDs) or map of user IDs containg the lists of clients
105
105
  */
106
- const createSessions = async ({ userClientMap, domain, apiClient, coreCrypto, logger, }) => {
106
+ const createSessions = async ({ userClientMap, domain, apiClient, cryptoClient, logger, }) => {
107
107
  if (domain) {
108
- return await createQualifiedSessions({ userClientMap, domain, apiClient, coreCrypto, logger });
108
+ return await createQualifiedSessions({ userClientMap, domain, apiClient, cryptoClient, logger });
109
109
  }
110
110
  return await createLegacySessions({
111
111
  userClients: userClientMap,
112
112
  apiClient,
113
- coreCrypto,
113
+ cryptoClient,
114
114
  logger,
115
115
  });
116
116
  };
117
117
  /**
118
118
  * Will make sure all the sessions need to encrypt for those user/clients pair are set
119
119
  */
120
- const initSessions = async ({ recipients, domain = '', apiClient, coreCrypto, logger, }) => {
120
+ const initSessions = async ({ recipients, domain = '', apiClient, cryptoClient, logger, }) => {
121
121
  const missingUserClients = {};
122
122
  const existingSessions = [];
123
123
  const users = (0, UserClientsUtil_1.flattenUserClients)(recipients, domain);
@@ -126,7 +126,7 @@ const initSessions = async ({ recipients, domain = '', apiClient, coreCrypto, lo
126
126
  const clients = Array.isArray(data) ? data : Object.keys(data);
127
127
  for (const clientId of clients) {
128
128
  const sessionId = constructSessionId({ userId, clientId, useQualifiedIds: !!domain });
129
- if (await coreCrypto.proteusSessionExists(sessionId)) {
129
+ if (await cryptoClient.sessionExists(sessionId)) {
130
130
  existingSessions.push(sessionId);
131
131
  continue;
132
132
  }
@@ -141,18 +141,18 @@ const initSessions = async ({ recipients, domain = '', apiClient, coreCrypto, lo
141
141
  userClientMap: missingUserClients,
142
142
  domain,
143
143
  apiClient,
144
- coreCrypto,
144
+ cryptoClient,
145
145
  logger,
146
146
  });
147
147
  return [...existingSessions, ...newSessions];
148
148
  };
149
149
  exports.initSessions = initSessions;
150
- function deleteSession(params) {
150
+ async function deleteSession(params) {
151
151
  const sessionId = constructSessionId(params);
152
- return params.coreCrypto.proteusSessionDelete(sessionId);
152
+ await params.cryptoClient.deleteSession(sessionId);
153
153
  }
154
154
  exports.deleteSession = deleteSession;
155
- const createSessionsFromPreKeys = async ({ preKeyBundleMap, domain = '', useQualifiedIds, coreCrypto, logger, }) => {
155
+ const createSessionsFromPreKeys = async ({ preKeyBundleMap, domain = '', useQualifiedIds, cryptoClient, logger, }) => {
156
156
  const sessions = [];
157
157
  for (const userId in preKeyBundleMap) {
158
158
  const userClients = preKeyBundleMap[userId];
@@ -164,8 +164,8 @@ const createSessionsFromPreKeys = async ({ preKeyBundleMap, domain = '', useQual
164
164
  continue;
165
165
  }
166
166
  const prekeyBuffer = bazinga64_1.Decoder.fromBase64(prekey.key).asBytes;
167
- await coreCrypto.proteusSessionFromPrekey(sessionId, prekeyBuffer);
168
- await coreCrypto.proteusSessionSave(sessionId);
167
+ await cryptoClient.sessionFromPrekey(sessionId, prekeyBuffer);
168
+ await cryptoClient.saveSession(sessionId);
169
169
  sessions.push(sessionId);
170
170
  }
171
171
  }
@@ -19,6 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const SessionHandler_1 = require("./SessionHandler");
22
+ const CryptoClient_1 = require("../../ProteusService/CryptoClient");
22
23
  const ProteusService_mocks_1 = require("../../ProteusService/ProteusService.mocks");
23
24
  describe('SessionHandler', () => {
24
25
  describe('constructSessionId', () => {
@@ -68,7 +69,7 @@ describe('SessionHandler', () => {
68
69
  const { apiClient, coreCrypto } = (await (0, ProteusService_mocks_1.buildProteusService)())[1];
69
70
  jest.spyOn(coreCrypto, 'proteusSessionExists').mockResolvedValue(true);
70
71
  const sessionFromPrekeySpy = jest.spyOn(coreCrypto, 'proteusSessionFromPrekey');
71
- await (0, SessionHandler_1.initSession)({ userId: { id: 'user1', domain: 'domain' }, clientId: 'client1' }, { apiClient, coreCrypto });
72
+ await (0, SessionHandler_1.initSession)({ userId: { id: 'user1', domain: 'domain' }, clientId: 'client1' }, { apiClient, cryptoClient: (0, CryptoClient_1.wrapCryptoClient)(coreCrypto, {}, {}) });
72
73
  expect(sessionFromPrekeySpy).not.toHaveBeenCalled();
73
74
  });
74
75
  it('creates the session if it does not already exist', async () => {
@@ -87,7 +88,7 @@ describe('SessionHandler', () => {
87
88
  useQualifiedIds: true,
88
89
  });
89
90
  const sessionFromPrekeySpy = jest.spyOn(coreCrypto, 'proteusSessionFromPrekey');
90
- await (0, SessionHandler_1.initSession)({ userId: { id: 'user1', domain: 'domain' }, clientId: 'client1' }, { apiClient, coreCrypto });
91
+ await (0, SessionHandler_1.initSession)({ userId: { id: 'user1', domain: 'domain' }, clientId: 'client1' }, { apiClient, cryptoClient: (0, CryptoClient_1.wrapCryptoClient)(coreCrypto, {}, {}) });
91
92
  expect(sessionFromPrekeySpy).toHaveBeenCalledWith(sessionId, expect.any(Object));
92
93
  });
93
94
  });
@@ -128,7 +129,7 @@ describe('SessionHandler', () => {
128
129
  const sessions = await (0, SessionHandler_1.initSessions)({
129
130
  recipients: Object.assign(Object.assign({}, existingUserClients), missingUserClients),
130
131
  apiClient,
131
- coreCrypto,
132
+ cryptoClient: (0, CryptoClient_1.wrapCryptoClient)(coreCrypto, {}, {}),
132
133
  });
133
134
  expect(sessionFromPrekeySpy).toHaveBeenCalledTimes(3);
134
135
  expect(sessions).toHaveLength(6);
@@ -27,14 +27,14 @@ export interface NotificationService {
27
27
  on(event: TOPIC.NOTIFICATION_ERROR, listener: (payload: NotificationError) => void): this;
28
28
  }
29
29
  export declare class NotificationService extends EventEmitter {
30
- private readonly mlsService;
31
30
  private readonly proteusService;
31
+ private readonly mlsService?;
32
32
  private readonly apiClient;
33
33
  private readonly backend;
34
34
  private readonly database;
35
35
  private readonly logger;
36
36
  static readonly TOPIC: typeof TOPIC;
37
- constructor(apiClient: APIClient, mlsService: MLSService, proteusService: ProteusService, storeEngine: CRUDEngine);
37
+ constructor(apiClient: APIClient, proteusService: ProteusService, storeEngine: CRUDEngine, mlsService?: MLSService | undefined);
38
38
  private getAllNotifications;
39
39
  /** Should only be called with a completely new client. */
40
40
  initializeNotificationStream(): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAC,YAAY,EAAqB,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGzD,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,UAAU,EAA4B,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAY,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,aAAK,KAAK;IACR,kBAAkB,iDAAiD;CACpE;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,mBAAmB;IAClC,EAA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OTIFICATION_ERROR"] = "NotificationService.TOPIC.NOTIFICATION_ERROR";
48
48
  })(TOPIC || (TOPIC = {}));
49
49
  class NotificationService extends events_1.EventEmitter {
50
- constructor(apiClient, mlsService, proteusService, storeEngine) {
50
+ constructor(apiClient, proteusService, storeEngine, mlsService) {
51
51
  super();
52
- this.mlsService = mlsService;
53
52
  this.proteusService = proteusService;
53
+ this.mlsService = mlsService;
54
54
  this.logger = (0, logdown_1.default)('@wireapp/core/NotificationService', {
55
55
  logger: console,
56
56
  markdown: false,
@@ -192,9 +192,9 @@ class NotificationService extends events_1.EventEmitter {
192
192
  * @return the decrypted payload and the raw event. Returns `undefined` when the payload is a coreCrypto-only system message
193
193
  */
194
194
  async handleEvent(event, source, dryRun = false) {
195
- var _a;
195
+ var _a, _b;
196
196
  // Handle MLS Events
197
- const mlsResult = await this.mlsService.handleEvent({ event, source, dryRun });
197
+ const mlsResult = await ((_a = this.mlsService) === null || _a === void 0 ? void 0 : _a.handleEvent({ event, source, dryRun }));
198
198
  if (mlsResult) {
199
199
  return mlsResult;
200
200
  }
@@ -212,7 +212,7 @@ class NotificationService extends events_1.EventEmitter {
212
212
  case event_1.CONVERSATION_EVENT.MEMBER_JOIN:
213
213
  // As of today (07/07/2022) the backend sends `WELCOME` message to the user's own conversation (not the actual conversation that the welcome should be part of)
214
214
  // So in order to map conversation Ids and groupId together, we need to first fetch the conversation and get the groupId linked to it.
215
- const conversation = await this.apiClient.api.conversation.getConversation((_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' });
215
+ const conversation = await this.apiClient.api.conversation.getConversation((_b = event.qualified_conversation) !== null && _b !== void 0 ? _b : { id: event.conversation, domain: '' });
216
216
  if (!conversation) {
217
217
  throw new Error('no conv');
218
218
  }
@@ -35,7 +35,7 @@ describe('NotificationService', () => {
35
35
  const storeEngine = new store_engine_1.MemoryEngine();
36
36
  await storeEngine.init('NotificationService.test');
37
37
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
38
- const notificationService = new _1.NotificationService(apiClient, mockedMLSService, mockedProteusService, storeEngine);
38
+ const notificationService = new _1.NotificationService(apiClient, mockedProteusService, storeEngine, mockedMLSService);
39
39
  jest.spyOn(notificationService, 'handleEvent').mockImplementation(() => {
40
40
  throw new Error('Test error');
41
41
  });
@@ -58,7 +58,7 @@ describe('NotificationService', () => {
58
58
  const storeEngine = new store_engine_1.MemoryEngine();
59
59
  await storeEngine.init('NotificationService.test');
60
60
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
61
- const notificationService = new _1.NotificationService(apiClient, mockedMLSService, mockedProteusService, storeEngine);
61
+ const notificationService = new _1.NotificationService(apiClient, mockedProteusService, storeEngine, mockedMLSService);
62
62
  jest.spyOn(notificationService, 'handleEvent').mockReturnValue({});
63
63
  const spySetLastNotificationId = jest
64
64
  .spyOn(notificationService, 'setLastNotificationId')
@@ -76,7 +76,7 @@ describe('NotificationService', () => {
76
76
  const storeEngine = new store_engine_1.MemoryEngine();
77
77
  await storeEngine.init('NotificationService.test');
78
78
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
79
- const notificationService = new _1.NotificationService(apiClient, mockedMLSService, mockedProteusService, storeEngine);
79
+ const notificationService = new _1.NotificationService(apiClient, mockedProteusService, storeEngine, mockedMLSService);
80
80
  jest.spyOn(notificationService, 'handleEvent').mockReturnValue({});
81
81
  const spySetLastNotificationId = jest
82
82
  .spyOn(notificationService, 'setLastNotificationId')
@@ -94,7 +94,7 @@ describe('NotificationService', () => {
94
94
  const storeEngine = new store_engine_1.MemoryEngine();
95
95
  await storeEngine.init('NotificationService.test');
96
96
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
97
- const notificationService = new _1.NotificationService(apiClient, mockedMLSService, mockedProteusService, storeEngine);
97
+ const notificationService = new _1.NotificationService(apiClient, mockedProteusService, storeEngine, mockedMLSService);
98
98
  notificationService.on(_1.NotificationService.TOPIC.NOTIFICATION_ERROR, notificationError => {
99
99
  expect(notificationError.error.message).toBe('Test error');
100
100
  expect(spySetLastNotificationId).toHaveBeenCalledTimes(0);
@@ -56,7 +56,7 @@ class EncryptedStore {
56
56
  }
57
57
  async wipe() {
58
58
  this.db.close();
59
- (0, idb_1.deleteDB)(this.db.name);
59
+ await (0, idb_1.deleteDB)(this.db.name);
60
60
  }
61
61
  }
62
62
  exports.EncryptedStore = EncryptedStore;
package/package.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "@wireapp/api-client": "^22.14.1",
15
15
  "@wireapp/commons": "^5.0.4",
16
16
  "@wireapp/core-crypto": "0.6.0-rc.3",
17
+ "@wireapp/cryptobox": "12.8.0",
17
18
  "@wireapp/promise-queue": "^2.1.1",
18
19
  "@wireapp/protocol-messaging": "1.43.0",
19
20
  "@wireapp/store-engine": "5.0.3",
@@ -59,6 +60,6 @@
59
60
  "test:coverage": "jest --coverage",
60
61
  "watch": "tsc --watch"
61
62
  },
62
- "version": "38.3.3",
63
- "gitHead": "7a635f647d5a7339bddcd75d31df1b3446e9f4c0"
63
+ "version": "38.4.0",
64
+ "gitHead": "0617f4045c95b97482af997a13dd43d97ead0e21"
64
65
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrekeysGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,+CAA+C,CAAC;AAKzE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAEzD,KAAK,yBAAyB,GAAG,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAEtE,UAAU,sBAAsB;IAC9B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C;AACD,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAE1B,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,WAAW,CAAwB;gBAGxB,SAAS,EAAE,yBAAyB,EACrD,EAAE,EAAE,YAAY,EACR,MAAM,EAAE,sBAAsB;YAK1B,cAAc;YAKd,eAAe;IASvB,aAAa;IAUnB,OAAO,CAAC,sBAAsB;IAM9B;;;;OAIG;IACG,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAM1D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrekeysGenerator.store.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.store.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAQxD,qBAAa,qBAAqB;IACpB,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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PrekeysGenerator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrekeysGenerator.test.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './PrekeysGenerator';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/PrekeysGenerator/index.ts"],"names":[],"mappings":"AAmBA,cAAc,oBAAoB,CAAC"}