@wireapp/core 42.11.0 → 42.12.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.
Files changed (82) hide show
  1. package/lib/Account.d.ts +6 -2
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +32 -12
  4. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  5. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +125 -0
  6. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts.map +1 -0
  7. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.js +157 -0
  8. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.d.ts +17 -0
  9. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.d.ts.map +1 -0
  10. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.js +20 -0
  11. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.d.ts +2 -0
  12. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.d.ts.map +1 -0
  13. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.js +35 -0
  14. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +306 -0
  15. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts.map +1 -0
  16. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.js +117 -0
  17. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.d.ts +2 -0
  18. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.d.ts.map +1 -0
  19. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.js +35 -0
  20. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +43 -0
  21. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -0
  22. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +25 -0
  23. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +17 -0
  24. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -0
  25. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +85 -0
  26. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +24 -0
  27. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -0
  28. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +263 -0
  29. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +12 -0
  30. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -0
  31. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +46 -0
  32. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts +12 -0
  33. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts.map +1 -0
  34. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.js +32 -0
  35. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts +15 -0
  36. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts.map +1 -0
  37. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.js +49 -0
  38. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.d.ts +14 -0
  39. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.d.ts.map +1 -0
  40. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.js +33 -0
  41. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts +12 -0
  42. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts.map +1 -0
  43. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.js +63 -0
  44. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts +20 -0
  45. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts.map +1 -0
  46. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.js +20 -0
  47. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.d.ts +2 -0
  48. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.d.ts.map +1 -0
  49. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.js +35 -0
  50. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts +28 -0
  51. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts.map +1 -0
  52. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.js +34 -0
  53. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts +28 -0
  54. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts.map +1 -0
  55. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.js +56 -0
  56. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts +28 -0
  57. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts.map +1 -0
  58. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.js +120 -0
  59. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts +136 -0
  60. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts.map +1 -0
  61. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.js +49 -0
  62. package/lib/messagingProtocols/mls/E2EIdentityService/index.d.ts +4 -0
  63. package/lib/messagingProtocols/mls/E2EIdentityService/index.d.ts.map +1 -0
  64. package/lib/messagingProtocols/mls/E2EIdentityService/index.js +37 -0
  65. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +21 -6
  66. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  67. package/lib/messagingProtocols/mls/MLSService/MLSService.js +81 -11
  68. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +27 -10
  69. package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts +4 -0
  70. package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts.map +1 -1
  71. package/lib/messagingProtocols/mls/types.d.ts +1 -0
  72. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  73. package/lib/util/LocalStorageStore/index.d.ts +7 -0
  74. package/lib/util/LocalStorageStore/index.d.ts.map +1 -0
  75. package/lib/util/LocalStorageStore/index.js +38 -0
  76. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +1 -1
  77. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +1 -1
  78. package/lib/util/TaskScheduler/TaskScheduler.store.js +3 -13
  79. package/lib/util/index.d.ts +1 -0
  80. package/lib/util/index.d.ts.map +1 -1
  81. package/lib/util/index.js +1 -0
  82. package/package.json +5 -4
@@ -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("./DpopChallenge"), exports);
@@ -0,0 +1,28 @@
1
+ import { GetAuthorizationReturnValue } from './Authorization';
2
+ import { AcmeService } from '../Connection/AcmeServer';
3
+ import { E2eiEnrollment, Nonce } from '../E2EIService.types';
4
+ interface DoWireOidcChallengeParams {
5
+ authData: GetAuthorizationReturnValue;
6
+ identity: E2eiEnrollment;
7
+ connection: AcmeService;
8
+ nonce: Nonce;
9
+ oAuthIdToken: string;
10
+ }
11
+ export declare const doWireOidcChallenge: ({ connection, authData, identity, nonce, oAuthIdToken, }: DoWireOidcChallengeParams) => Promise<{
12
+ data: {
13
+ type: string;
14
+ url: string;
15
+ target: string;
16
+ status: string;
17
+ token: string;
18
+ validated?: string | undefined;
19
+ error?: {
20
+ type: string;
21
+ detail: string;
22
+ } | undefined;
23
+ };
24
+ nonce: string;
25
+ location?: string | undefined;
26
+ }>;
27
+ export {};
28
+ //# sourceMappingURL=OidcChallenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OidcChallenge.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAE3D,UAAU,yBAAyB;IACjC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,6DAM7B,yBAAyB;;;;;;;;;;;;;;;EAc3B,CAAC"}
@@ -0,0 +1,34 @@
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.doWireOidcChallenge = void 0;
22
+ const doWireOidcChallenge = async ({ connection, authData, identity, nonce, oAuthIdToken, }) => {
23
+ const { wireOidcChallenge } = authData.authorization;
24
+ if (!wireOidcChallenge) {
25
+ throw new Error('No wireOIDCChallenge defined');
26
+ }
27
+ const reqBody = identity.newOidcChallengeRequest(oAuthIdToken, nonce);
28
+ const oidcChallengeResponse = await connection.validateOidcChallenge(wireOidcChallenge.url, reqBody);
29
+ if (!oidcChallengeResponse) {
30
+ throw new Error('No response received while validating OIDC challenge');
31
+ }
32
+ return oidcChallengeResponse;
33
+ };
34
+ exports.doWireOidcChallenge = doWireOidcChallenge;
@@ -0,0 +1,28 @@
1
+ import { AcmeService } from '../Connection';
2
+ import { AcmeDirectory, E2eiEnrollment, NewAcmeOrder, Nonce } from '../E2EIService.types';
3
+ type OrderUrl = string;
4
+ export interface CreateNewOrderParams {
5
+ identity: E2eiEnrollment;
6
+ nonce: Nonce;
7
+ directory: AcmeDirectory;
8
+ connection: AcmeService;
9
+ }
10
+ export type CreateNewOrderReturnValue = Promise<{
11
+ order: NewAcmeOrder;
12
+ nonce: string;
13
+ authzUrl: string;
14
+ orderUrl: OrderUrl;
15
+ }>;
16
+ export declare const createNewOrder: ({ identity, nonce, directory, connection, }: CreateNewOrderParams) => CreateNewOrderReturnValue;
17
+ export interface FinalizeOrderParams {
18
+ connection: AcmeService;
19
+ identity: E2eiEnrollment;
20
+ nonce: Nonce;
21
+ orderUrl: OrderUrl;
22
+ }
23
+ export declare const finalizeOrder: ({ identity, nonce, orderUrl, connection }: FinalizeOrderParams) => Promise<{
24
+ certificateUrl: string;
25
+ nonce: string;
26
+ }>;
27
+ export {};
28
+ //# sourceMappingURL=Order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Order.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAGxF,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;CACzB;AACD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC;IAC9C,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC,CAAC;AAEH,eAAO,MAAM,cAAc,gDAKxB,oBAAoB,8BAatB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AACD,eAAO,MAAM,aAAa,8CAAmD,mBAAmB;;;EAqB/F,CAAC"}
@@ -0,0 +1,56 @@
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.finalizeOrder = exports.createNewOrder = void 0;
22
+ const Helper_1 = require("../Helper");
23
+ const createNewOrder = async ({ identity, nonce, directory, connection, }) => {
24
+ var _a;
25
+ const reqBody = identity.newOrderRequest(nonce);
26
+ const response = await connection.createNewOrder(directory.newOrder, reqBody);
27
+ if ((response === null || response === void 0 ? void 0 : response.data) && !!response.data.status.length && !!response.nonce.length && !!((_a = response.location) === null || _a === void 0 ? void 0 : _a.length)) {
28
+ return {
29
+ order: identity.newOrderResponse((0, Helper_1.jsonToByteArray)(response.data)),
30
+ authzUrl: response.data.authorizations[0],
31
+ nonce: response.nonce,
32
+ orderUrl: response.location,
33
+ };
34
+ }
35
+ throw new Error('No createNewOrder-data received');
36
+ };
37
+ exports.createNewOrder = createNewOrder;
38
+ const finalizeOrder = async ({ identity, nonce, orderUrl, connection }) => {
39
+ const statusReqBody = identity.checkOrderRequest(orderUrl, nonce);
40
+ const statusResponse = await connection.checkStatusOfOrder(orderUrl, statusReqBody);
41
+ if ((statusResponse === null || statusResponse === void 0 ? void 0 : statusResponse.data) && !!statusResponse.data.status.length && !!statusResponse.nonce.length) {
42
+ const finalizeUrl = identity.checkOrderResponse((0, Helper_1.jsonToByteArray)(statusResponse.data));
43
+ const finalizeReqBody = identity.finalizeRequest(statusResponse.nonce);
44
+ const finalizeResponse = await connection.finalizeOrder(finalizeUrl, finalizeReqBody);
45
+ if ((finalizeResponse === null || finalizeResponse === void 0 ? void 0 : finalizeResponse.data) && !!finalizeResponse.data.status.length && !!finalizeResponse.nonce.length) {
46
+ const certificateUrl = identity.finalizeResponse((0, Helper_1.jsonToByteArray)(finalizeResponse.data));
47
+ return {
48
+ certificateUrl,
49
+ nonce: finalizeResponse.nonce,
50
+ };
51
+ }
52
+ throw new Error('Error while finalizing order');
53
+ }
54
+ throw new Error('Error while checking status of order');
55
+ };
56
+ exports.finalizeOrder = finalizeOrder;
@@ -0,0 +1,28 @@
1
+ import { AuthData, InitialData, OrderData } from './E2EIStorage.schema';
2
+ export declare const E2EIStorage: {
3
+ store: {
4
+ handle: (handle: string) => void;
5
+ authData: (data: AuthData) => void;
6
+ orderData: (data: OrderData) => void;
7
+ initialData: (data: InitialData) => void;
8
+ certificate: (data: string) => void;
9
+ };
10
+ get: {
11
+ initialData: () => InitialData;
12
+ certificateData: () => string;
13
+ handle: () => string;
14
+ authData: () => AuthData;
15
+ orderData: () => OrderData;
16
+ };
17
+ has: {
18
+ handle: () => boolean;
19
+ initialData: () => boolean;
20
+ certificateData: () => boolean;
21
+ };
22
+ remove: {
23
+ temporaryData: () => void;
24
+ certificateData: () => void;
25
+ all: () => void;
26
+ };
27
+ };
28
+ //# sourceMappingURL=E2EIStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"E2EIStorage.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAAkB,WAAW,EAAqB,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAuFzG,eAAO,MAAM,WAAW;;yBA3EK,MAAM;yBAEN,QAAQ;0BADP,SAAS;4BAEP,WAAW;4BACX,MAAM;;;2BA0BX,WAAW;+BAoBP,MAAM;;wBA9BJ,QAAQ;yBAoBP,SAAS;;;;;;;;;;;;CA4D1C,CAAC"}
@@ -0,0 +1,120 @@
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.E2EIStorage = void 0;
22
+ const E2EIStorage_schema_1 = require("./E2EIStorage.schema");
23
+ const LocalStorageStore_1 = require("../../../../util/LocalStorageStore");
24
+ const HandleKey = 'Handle';
25
+ const AuthDataKey = 'AuthData';
26
+ const OderDataKey = 'OrderData';
27
+ const InitialDataKey = 'InitialData';
28
+ const CertificateDataKey = 'CertificateData';
29
+ const storage = (0, LocalStorageStore_1.LocalStorageStore)('E2EIStorage');
30
+ const storeHandle = (handle) => storage.add(HandleKey, window.btoa(handle));
31
+ const storeOrderData = (data) => storage.add(OderDataKey, window.btoa(JSON.stringify(data)));
32
+ const storeAuthData = (data) => storage.add(AuthDataKey, window.btoa(JSON.stringify(data)));
33
+ const storeInitialData = (data) => storage.add(InitialDataKey, window.btoa(JSON.stringify(data)));
34
+ const storeCertificate = (data) => storage.add(CertificateDataKey, window.btoa(data));
35
+ const hasHandle = () => storage.has(HandleKey);
36
+ const hasInitialData = () => storage.has(InitialDataKey);
37
+ const hasCertificateData = () => storage.has(CertificateDataKey);
38
+ const getAndVerifyHandle = () => {
39
+ const handle = storage.get(HandleKey);
40
+ if (!handle) {
41
+ throw new Error('ACME: No handle found');
42
+ }
43
+ storage.remove(HandleKey);
44
+ const atob = window.atob(handle);
45
+ return atob;
46
+ };
47
+ const getAndVerifyAuthData = () => {
48
+ const data = storage.get(AuthDataKey);
49
+ if (!data) {
50
+ throw new Error('ACME: AuthData not found');
51
+ }
52
+ storage.remove(AuthDataKey);
53
+ const atob = window.atob(data);
54
+ return E2EIStorage_schema_1.AuthDataSchema.parse(JSON.parse(atob));
55
+ };
56
+ const getInitialData = () => {
57
+ const data = storage.get(InitialDataKey);
58
+ if (!data) {
59
+ throw new Error('ACME: InitialData not found');
60
+ }
61
+ storage.remove(InitialDataKey);
62
+ const atob = window.atob(data);
63
+ return E2EIStorage_schema_1.InitialDataSchema.parse(JSON.parse(atob));
64
+ };
65
+ const getAndVerifyOrderData = () => {
66
+ const data = storage.get(OderDataKey);
67
+ if (!data) {
68
+ throw new Error('ACME: OrderData not found');
69
+ }
70
+ storage.remove(OderDataKey);
71
+ const atob = window.atob(data);
72
+ return JSON.parse(atob);
73
+ };
74
+ const getCertificateData = () => {
75
+ const data = storage.get(CertificateDataKey);
76
+ if (!data) {
77
+ throw new Error('ACME: CertificateData not found');
78
+ }
79
+ const atob = window.atob(data);
80
+ return atob;
81
+ };
82
+ const removeTemporaryData = () => {
83
+ storage.remove(HandleKey);
84
+ storage.remove(AuthDataKey);
85
+ storage.remove(OderDataKey);
86
+ storage.remove(InitialDataKey);
87
+ };
88
+ const removeCertificateData = () => {
89
+ storage.remove(CertificateDataKey);
90
+ };
91
+ const removeAll = () => {
92
+ removeTemporaryData();
93
+ removeCertificateData();
94
+ };
95
+ exports.E2EIStorage = {
96
+ store: {
97
+ handle: storeHandle,
98
+ authData: storeAuthData,
99
+ orderData: storeOrderData,
100
+ initialData: storeInitialData,
101
+ certificate: storeCertificate,
102
+ },
103
+ get: {
104
+ initialData: getInitialData,
105
+ certificateData: getCertificateData,
106
+ handle: getAndVerifyHandle,
107
+ authData: getAndVerifyAuthData,
108
+ orderData: getAndVerifyOrderData,
109
+ },
110
+ has: {
111
+ handle: hasHandle,
112
+ initialData: hasInitialData,
113
+ certificateData: hasCertificateData,
114
+ },
115
+ remove: {
116
+ temporaryData: removeTemporaryData,
117
+ certificateData: removeCertificateData,
118
+ all: removeAll,
119
+ },
120
+ };
@@ -0,0 +1,136 @@
1
+ import { z } from 'zod';
2
+ export declare const InitialDataSchema: z.ZodObject<{
3
+ discoveryUrl: z.ZodString;
4
+ clientId: z.ZodString;
5
+ user: z.ZodObject<{
6
+ id: z.ZodString;
7
+ displayName: z.ZodString;
8
+ handle: z.ZodString;
9
+ domain: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ id: string;
12
+ domain: string;
13
+ handle: string;
14
+ displayName: string;
15
+ }, {
16
+ id: string;
17
+ domain: string;
18
+ handle: string;
19
+ displayName: string;
20
+ }>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ user: {
23
+ id: string;
24
+ domain: string;
25
+ handle: string;
26
+ displayName: string;
27
+ };
28
+ clientId: string;
29
+ discoveryUrl: string;
30
+ }, {
31
+ user: {
32
+ id: string;
33
+ domain: string;
34
+ handle: string;
35
+ displayName: string;
36
+ };
37
+ clientId: string;
38
+ discoveryUrl: string;
39
+ }>;
40
+ export type InitialData = z.infer<typeof InitialDataSchema>;
41
+ export declare const AuthDataSchema: z.ZodObject<{
42
+ authorization: z.ZodObject<{
43
+ identifier: z.ZodString;
44
+ wireDpopChallenge: z.ZodOptional<z.ZodObject<{
45
+ delegate: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
46
+ url: z.ZodString;
47
+ target: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ url: string;
50
+ target: string;
51
+ delegate: Uint8Array;
52
+ }, {
53
+ url: string;
54
+ target: string;
55
+ delegate: Uint8Array;
56
+ }>>;
57
+ wireOidcChallenge: z.ZodOptional<z.ZodObject<{
58
+ delegate: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
59
+ url: z.ZodString;
60
+ target: z.ZodString;
61
+ }, "strip", z.ZodTypeAny, {
62
+ url: string;
63
+ target: string;
64
+ delegate: Uint8Array;
65
+ }, {
66
+ url: string;
67
+ target: string;
68
+ delegate: Uint8Array;
69
+ }>>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ identifier: string;
72
+ wireDpopChallenge?: {
73
+ url: string;
74
+ target: string;
75
+ delegate: Uint8Array;
76
+ } | undefined;
77
+ wireOidcChallenge?: {
78
+ url: string;
79
+ target: string;
80
+ delegate: Uint8Array;
81
+ } | undefined;
82
+ }, {
83
+ identifier: string;
84
+ wireDpopChallenge?: {
85
+ url: string;
86
+ target: string;
87
+ delegate: Uint8Array;
88
+ } | undefined;
89
+ wireOidcChallenge?: {
90
+ url: string;
91
+ target: string;
92
+ delegate: Uint8Array;
93
+ } | undefined;
94
+ }>;
95
+ nonce: z.ZodString;
96
+ }, "strip", z.ZodTypeAny, {
97
+ nonce: string;
98
+ authorization: {
99
+ identifier: string;
100
+ wireDpopChallenge?: {
101
+ url: string;
102
+ target: string;
103
+ delegate: Uint8Array;
104
+ } | undefined;
105
+ wireOidcChallenge?: {
106
+ url: string;
107
+ target: string;
108
+ delegate: Uint8Array;
109
+ } | undefined;
110
+ };
111
+ }, {
112
+ nonce: string;
113
+ authorization: {
114
+ identifier: string;
115
+ wireDpopChallenge?: {
116
+ url: string;
117
+ target: string;
118
+ delegate: Uint8Array;
119
+ } | undefined;
120
+ wireOidcChallenge?: {
121
+ url: string;
122
+ target: string;
123
+ delegate: Uint8Array;
124
+ } | undefined;
125
+ };
126
+ }>;
127
+ export type AuthData = z.infer<typeof AuthDataSchema>;
128
+ export declare const OrderDataSchema: z.ZodObject<{
129
+ orderUrl: z.ZodString;
130
+ }, "strip", z.ZodTypeAny, {
131
+ orderUrl: string;
132
+ }, {
133
+ orderUrl: string;
134
+ }>;
135
+ export type OrderData = z.infer<typeof OrderDataSchema>;
136
+ //# sourceMappingURL=E2EIStorage.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"E2EIStorage.schema.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAU5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,49 @@
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.OrderDataSchema = exports.AuthDataSchema = exports.InitialDataSchema = void 0;
22
+ const zod_1 = require("zod");
23
+ exports.InitialDataSchema = zod_1.z.object({
24
+ discoveryUrl: zod_1.z.string(),
25
+ clientId: zod_1.z.string(),
26
+ user: zod_1.z.object({
27
+ id: zod_1.z.string(),
28
+ displayName: zod_1.z.string(),
29
+ handle: zod_1.z.string(),
30
+ domain: zod_1.z.string(),
31
+ }),
32
+ });
33
+ const Uint8ArraySchema = zod_1.z.custom(value => value instanceof Uint8Array ? { success: true } : { success: false, message: 'Expected Uint8Array' });
34
+ const AcmeChallengeSchema = zod_1.z.object({
35
+ delegate: Uint8ArraySchema,
36
+ url: zod_1.z.string(),
37
+ target: zod_1.z.string(),
38
+ });
39
+ exports.AuthDataSchema = zod_1.z.object({
40
+ authorization: zod_1.z.object({
41
+ identifier: zod_1.z.string(),
42
+ wireDpopChallenge: AcmeChallengeSchema.optional(),
43
+ wireOidcChallenge: AcmeChallengeSchema.optional(),
44
+ }),
45
+ nonce: zod_1.z.string(),
46
+ });
47
+ exports.OrderDataSchema = zod_1.z.object({
48
+ orderUrl: zod_1.z.string().url(),
49
+ });
@@ -0,0 +1,4 @@
1
+ export * from './E2EIService.types';
2
+ export * from './E2EIServiceInternal';
3
+ export * from './E2EIServiceExternal';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/index.ts"],"names":[],"mappings":"AAmBA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,37 @@
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("./E2EIService.types"), exports);
36
+ __exportStar(require("./E2EIServiceInternal"), exports);
37
+ __exportStar(require("./E2EIServiceExternal"), exports);
@@ -11,7 +11,8 @@ import { MLSServiceConfig } from './MLSService.types';
11
11
  import { KeyPackageClaimUser } from '../../../conversation';
12
12
  import { CoreDatabase } from '../../../storage/CoreDB';
13
13
  import { RecurringTaskScheduler } from '../../../util/RecurringTaskScheduler';
14
- import { CommitPendingProposalsParams, HandlePendingProposalsParams, MLSCallbacks } from '../types';
14
+ import { AcmeChallenge, E2EIServiceExternal, User } from '../E2EIdentityService';
15
+ import { ClientId, CommitPendingProposalsParams, HandlePendingProposalsParams, MLSCallbacks } from '../types';
15
16
  export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
16
17
  interface LocalMLSServiceConfig extends MLSServiceConfig {
17
18
  /**
@@ -21,7 +22,7 @@ interface LocalMLSServiceConfig extends MLSServiceConfig {
21
22
  }
22
23
  export interface SubconversationEpochInfoMember {
23
24
  userid: string;
24
- clientid: string;
25
+ clientid: ClientId;
25
26
  in_subconv: boolean;
26
27
  }
27
28
  type Events = {
@@ -122,7 +123,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
122
123
  * @param groupId groupId of the conversation
123
124
  * @param clientIds the list of **qualified** ids of the clients we want to remove from the group
124
125
  */
125
- removeClientsFromConversation(groupId: string, clientIds: string[]): Promise<PostMlsMessageResponse>;
126
+ removeClientsFromConversation(groupId: string, clientIds: ClientId[]): Promise<PostMlsMessageResponse>;
126
127
  private commitProposals;
127
128
  /**
128
129
  * Will check if mls group exists in corecrypto.
@@ -153,7 +154,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
153
154
  * Will cancel the renewal of the key material for a given groupId
154
155
  * @param groupId The group that should stop having its key material updated
155
156
  */
156
- cancelKeyMaterialRenewal(groupId: string): Promise<void>;
157
+ private cancelKeyMaterialRenewal;
157
158
  /**
158
159
  * Will schedule a task to update the key material of the conversation according to the threshold given as config
159
160
  * @param groupId
@@ -203,6 +204,9 @@ export declare class MLSService extends TypedEventEmitter<Events> {
203
204
  * @param eventTime time of the event that had the proposals
204
205
  */
205
206
  handlePendingProposals({ delayInMs, groupId, eventTime }: HandlePendingProposalsParams): Promise<void>;
207
+ private schedulePendingProposalsTask;
208
+ private cancelPendingProposalsTask;
209
+ private createPendingProposalsTaskKey;
206
210
  /**
207
211
  * Commit all pending proposals for a given groupId
208
212
  *
@@ -215,7 +219,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
215
219
  * Function must only be called once, after application start
216
220
  *
217
221
  */
218
- checkExistingPendingProposals(): Promise<void>;
222
+ initialisePendingProposalsTasks(): Promise<void>;
219
223
  /**
220
224
  * Get all conversation members client ids.
221
225
  *
@@ -223,11 +227,22 @@ export declare class MLSService extends TypedEventEmitter<Events> {
223
227
  */
224
228
  getClientIds(groupId: string): Promise<{
225
229
  userId: string;
226
- clientId: string;
230
+ clientId: ClientId;
227
231
  domain: string;
228
232
  }[]>;
229
233
  handleMLSMessageAddEvent(event: ConversationMLSMessageAddEvent): Promise<import("../../../notification").HandledEventPayload | null>;
230
234
  handleMLSWelcomeMessageEvent(event: ConversationMLSWelcomeEvent, clientId: string): Promise<import("../../../notification").HandledEventPayload>;
235
+ deleteMLSKeyPackages(clientId: ClientId, keyPackagRefs: Uint8Array[]): Promise<void>;
236
+ /**
237
+ *
238
+ * @param discoveryUrl URL of the acme server
239
+ * @param user User object
240
+ * @param clientId The client id of the current device
241
+ * @param nbPrekeys Amount of prekeys to generate
242
+ * @param oAuthIdToken The OAuth id token if the user is already authenticated
243
+ * @returns AcmeChallenge if the user is not authenticated, true if the user is authenticated
244
+ */
245
+ enrollE2EI(discoveryUrl: string, e2eiServiceExternal: E2EIServiceExternal, user: User, clientId: ClientId, nbPrekeys: number, oAuthIdToken?: string): Promise<AcmeChallenge | boolean>;
231
246
  }
232
247
  export {};
233
248
  //# sourceMappingURL=MLSService.d.ts.map