@wireapp/core 43.6.0 → 43.7.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.
@@ -6,10 +6,12 @@ export declare class AcmeService {
6
6
  private readonly axiosInstance;
7
7
  private readonly url;
8
8
  constructor(discoveryUrl: string);
9
+ private get acmeBaseUrl();
9
10
  private extractNonce;
10
11
  private extractLocation;
11
12
  private postJoseRequest;
12
13
  getDirectory(): GetDirectoryReturnValue;
14
+ getLocalCertificateRoot(): Promise<string>;
13
15
  getInitialNonce(url: AcmeDirectory['newNonce']): GetInitialNonceReturnValue;
14
16
  createNewAccount(url: AcmeDirectory['newAccount'], payload: Uint8Array): Promise<{
15
17
  data: {
@@ -24,13 +26,13 @@ export declare class AcmeService {
24
26
  data: {
25
27
  status: string;
26
28
  expires: string;
27
- authorizations: string[];
28
29
  notBefore: string;
29
30
  notAfter: string;
30
31
  identifiers: {
31
32
  type: string;
32
33
  value: string;
33
34
  }[];
35
+ authorizations: string[];
34
36
  finalize: string;
35
37
  };
36
38
  nonce: string;
@@ -86,13 +88,13 @@ export declare class AcmeService {
86
88
  id: string;
87
89
  status: string;
88
90
  expires: string;
89
- authorizations: string[];
90
91
  notBefore: string;
91
92
  notAfter: string;
92
93
  identifiers: {
93
94
  type: string;
94
95
  value: string;
95
96
  }[];
97
+ authorizations: string[];
96
98
  finalize: string;
97
99
  };
98
100
  nonce: string;
@@ -104,13 +106,13 @@ export declare class AcmeService {
104
106
  certificate: string;
105
107
  status: string;
106
108
  expires: string;
107
- authorizations: string[];
108
109
  notBefore: string;
109
110
  notAfter: string;
110
111
  identifiers: {
111
112
  type: string;
112
113
  value: string;
113
114
  }[];
115
+ authorizations: string[];
114
116
  finalize: string;
115
117
  };
116
118
  nonce: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AcmeService.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.ts"],"names":[],"m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E,UAAU;;;;;;;;;;;;;;;;;;IAS9C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;;;;;CAQ7D"}
@@ -31,9 +31,13 @@ class AcmeService {
31
31
  this.logger = (0, logdown_1.default)('@wireapp/core/AcmeService');
32
32
  this.axiosInstance = axios_1.default.create();
33
33
  this.url = {
34
- DIRECTORY: '/directory',
34
+ ROOTS: '/roots.pem',
35
35
  };
36
36
  }
37
+ get acmeBaseUrl() {
38
+ const { origin } = new URL(this.discoveryUrl);
39
+ return origin;
40
+ }
37
41
  // ############ Internal Functions ############
38
42
  extractNonce(headers) {
39
43
  return schema_1.ResponseHeaderNonceSchema.parse(headers)['replay-nonce'];
@@ -68,7 +72,7 @@ class AcmeService {
68
72
  // ############ Public Functions ############
69
73
  async getDirectory() {
70
74
  try {
71
- const { data } = await this.axiosInstance.get(`${this.discoveryUrl}${this.url.DIRECTORY}`);
75
+ const { data } = await this.axiosInstance.get(this.discoveryUrl);
72
76
  const directory = schema_1.DirectoryResponseSchema.parse(data);
73
77
  return new TextEncoder().encode(JSON.stringify(directory));
74
78
  }
@@ -77,6 +81,11 @@ class AcmeService {
77
81
  return undefined;
78
82
  }
79
83
  }
84
+ async getLocalCertificateRoot() {
85
+ const { data } = await this.axiosInstance.get(`${this.acmeBaseUrl}${this.url.ROOTS}`);
86
+ const localCertificateRoot = schema_1.LocalCertificateRootResponseSchema.parse(data);
87
+ return localCertificateRoot;
88
+ }
80
89
  async getInitialNonce(url) {
81
90
  try {
82
91
  const { headers } = await this.axiosInstance.head(url);
@@ -35,6 +35,8 @@ export declare const DirectoryResponseSchema: z.ZodObject<{
35
35
  keyChange: string;
36
36
  }>;
37
37
  export type DirectoryResponseData = z.infer<typeof DirectoryResponseSchema>;
38
+ export declare const LocalCertificateRootResponseSchema: z.ZodString;
39
+ export type LocalCertificateRootResonseData = z.infer<typeof LocalCertificateRootResponseSchema>;
38
40
  export declare const NewAccountResponseSchema: z.ZodObject<{
39
41
  status: z.ZodString;
40
42
  orders: z.ZodString;
@@ -69,24 +71,24 @@ export declare const NewOrderResponseSchema: z.ZodObject<{
69
71
  }, "strip", z.ZodTypeAny, {
70
72
  status: string;
71
73
  expires: string;
72
- authorizations: string[];
73
74
  notBefore: string;
74
75
  notAfter: string;
75
76
  identifiers: {
76
77
  type: string;
77
78
  value: string;
78
79
  }[];
80
+ authorizations: string[];
79
81
  finalize: string;
80
82
  }, {
81
83
  status: string;
82
84
  expires: string;
83
- authorizations: string[];
84
85
  notBefore: string;
85
86
  notAfter: string;
86
87
  identifiers: {
87
88
  type: string;
88
89
  value: string;
89
90
  }[];
91
+ authorizations: string[];
90
92
  finalize: string;
91
93
  }>;
92
94
  export type NewOrderResponseData = z.infer<typeof NewOrderResponseSchema>;
@@ -232,25 +234,25 @@ export declare const CheckStatusOfOrderResponseSchema: z.ZodObject<{
232
234
  id: string;
233
235
  status: string;
234
236
  expires: string;
235
- authorizations: string[];
236
237
  notBefore: string;
237
238
  notAfter: string;
238
239
  identifiers: {
239
240
  type: string;
240
241
  value: string;
241
242
  }[];
243
+ authorizations: string[];
242
244
  finalize: string;
243
245
  }, {
244
246
  id: string;
245
247
  status: string;
246
248
  expires: string;
247
- authorizations: string[];
248
249
  notBefore: string;
249
250
  notAfter: string;
250
251
  identifiers: {
251
252
  type: string;
252
253
  value: string;
253
254
  }[];
255
+ authorizations: string[];
254
256
  finalize: string;
255
257
  }>;
256
258
  export type CheckStatusOfOrderResponseData = z.infer<typeof CheckStatusOfOrderResponseSchema>;
@@ -278,26 +280,26 @@ export declare const FinalizeOrderResponseSchema: z.ZodObject<{
278
280
  certificate: string;
279
281
  status: string;
280
282
  expires: string;
281
- authorizations: string[];
282
283
  notBefore: string;
283
284
  notAfter: string;
284
285
  identifiers: {
285
286
  type: string;
286
287
  value: string;
287
288
  }[];
289
+ authorizations: string[];
288
290
  finalize: string;
289
291
  }, {
290
292
  id: string;
291
293
  certificate: string;
292
294
  status: string;
293
295
  expires: string;
294
- authorizations: string[];
295
296
  notBefore: string;
296
297
  notAfter: string;
297
298
  identifiers: {
298
299
  type: string;
299
300
  value: string;
300
301
  }[];
302
+ authorizations: string[];
301
303
  finalize: string;
302
304
  }>;
303
305
  export type FinalizeOrderResponseData = z.infer<typeof FinalizeOrderResponseSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAMlC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAajC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBtC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;EAKtC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAatC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE9F,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAetC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF,eAAO,MAAM,4BAA4B,aAAoB,CAAC;AAC9D,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eA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;AAE9F,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAetC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF,eAAO,MAAM,4BAA4B,aAAoB,CAAC;AAC9D,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.GetCertificateResponseSchema = exports.FinalizeOrderResponseSchema = exports.CheckStatusOfOrderResponseSchema = exports.OidcChallengeResponseSchema = exports.DpopChallengeResponseSchema = exports.AuthorizationResponseSchema = exports.NewOrderResponseSchema = exports.NewAccountResponseSchema = exports.DirectoryResponseSchema = exports.ResponseHeaderLocationSchema = exports.ResponseHeaderNonceSchema = void 0;
21
+ exports.GetCertificateResponseSchema = exports.FinalizeOrderResponseSchema = exports.CheckStatusOfOrderResponseSchema = exports.OidcChallengeResponseSchema = exports.DpopChallengeResponseSchema = exports.AuthorizationResponseSchema = exports.NewOrderResponseSchema = exports.NewAccountResponseSchema = exports.LocalCertificateRootResponseSchema = exports.DirectoryResponseSchema = exports.ResponseHeaderLocationSchema = exports.ResponseHeaderNonceSchema = void 0;
22
22
  const zod_1 = require("zod");
23
23
  const nonOptionalString = zod_1.z.string().min(1);
24
24
  const nonOptionalUrl = zod_1.z.string().url().min(1);
@@ -35,6 +35,7 @@ exports.DirectoryResponseSchema = zod_1.z.object({
35
35
  revokeCert: nonOptionalUrl,
36
36
  keyChange: nonOptionalUrl,
37
37
  });
38
+ exports.LocalCertificateRootResponseSchema = nonOptionalString;
38
39
  exports.NewAccountResponseSchema = zod_1.z.object({
39
40
  status: nonOptionalString,
40
41
  orders: nonOptionalUrl,
@@ -17,5 +17,22 @@ export declare class E2EIServiceExternal {
17
17
  getUsersIdentities(groupId: string, userIds: QualifiedId[]): Promise<Map<string, DeviceIdentity[]>>;
18
18
  getDevicesIdentities(groupId: string, userClientsMap: Record<string, QualifiedId>): Promise<DeviceIdentity[]>;
19
19
  isFreshMLSSelfClient(): Promise<boolean>;
20
+ private registerLocalCertificateRoot;
21
+ /**
22
+ * This function is used to register different server certificates in CoreCrypto.
23
+ *
24
+ * 1. Root Certificate: This is the root certificate of the server.
25
+ * - It must only be registered once.
26
+ * - It must be the first certificate to be registered. Nothing else will work
27
+ *
28
+ * 2. Intermediate Certificate: This is the intermediate certificate of the server. It must be updated every 24 hours.
29
+ * - It must be registered after the root certificate.
30
+ * - It must be updated every 24 hours.
31
+ *
32
+ * Both must be registered before the first enrollment.
33
+ *
34
+ * @param discoveryUrl
35
+ */
36
+ registerServerCertificates(discoveryUrl: string): Promise<void>;
20
37
  }
21
38
  //# sourceMappingURL=E2EIServiceExternal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAKhH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAG/G,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAFX,gBAAgB,EAA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C5B,WAAW,EAAE,WAAW;IAIpC,sBAAsB,IAAI,OAAO;IAIjC,gBAAgB,IAAI,IAAI;IAIxB,oBAAoB,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhF,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3B,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IA6CnG,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAef,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;YAQvC,4BAA4B;IAO1C;;;;;;;;;;;;;;OAcG;IACU,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB7E"}
@@ -20,9 +20,11 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.E2EIServiceExternal = void 0;
22
22
  const bazinga64_1 = require("bazinga64");
23
+ const Connection_1 = require("./Connection");
23
24
  const Helper_1 = require("./Helper");
24
25
  const E2EIStorage_1 = require("./Storage/E2EIStorage");
25
26
  const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
27
+ const LocalStorageStore_1 = require("../../../util/LocalStorageStore");
26
28
  // This export is meant to be accessible from the outside (e.g the Webapp / UI)
27
29
  class E2EIServiceExternal {
28
30
  constructor(coreCryptoClient, clientService, cipherSuite) {
@@ -78,5 +80,41 @@ class E2EIServiceExternal {
78
80
  }
79
81
  return typeof client.mls_public_keys.ed25519 !== 'string' || client.mls_public_keys.ed25519.length === 0;
80
82
  }
83
+ async registerLocalCertificateRoot(connection) {
84
+ const localCertificateRoot = await connection.getLocalCertificateRoot();
85
+ await this.coreCryptoClient.e2eiRegisterAcmeCA(localCertificateRoot);
86
+ return localCertificateRoot;
87
+ }
88
+ /**
89
+ * This function is used to register different server certificates in CoreCrypto.
90
+ *
91
+ * 1. Root Certificate: This is the root certificate of the server.
92
+ * - It must only be registered once.
93
+ * - It must be the first certificate to be registered. Nothing else will work
94
+ *
95
+ * 2. Intermediate Certificate: This is the intermediate certificate of the server. It must be updated every 24 hours.
96
+ * - It must be registered after the root certificate.
97
+ * - It must be updated every 24 hours.
98
+ *
99
+ * Both must be registered before the first enrollment.
100
+ *
101
+ * @param discoveryUrl
102
+ */
103
+ async registerServerCertificates(discoveryUrl) {
104
+ const ROOT_CA_KEY = 'e2ei_root-registered';
105
+ const store = (0, LocalStorageStore_1.LocalStorageStore)(ROOT_CA_KEY);
106
+ const acmeService = new Connection_1.AcmeService(discoveryUrl);
107
+ // Register root certificate if not already registered
108
+ if (!store.has(ROOT_CA_KEY)) {
109
+ try {
110
+ await this.registerLocalCertificateRoot(acmeService);
111
+ store.add(ROOT_CA_KEY, 'true');
112
+ }
113
+ catch (error) {
114
+ console.error('Failed to register root certificate', error);
115
+ }
116
+ }
117
+ // Register intermediate certificate and update it every 24 hours
118
+ }
81
119
  }
82
120
  exports.E2EIServiceExternal = E2EIServiceExternal;
package/package.json CHANGED
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "43.6.0",
65
- "gitHead": "3c857459c0615584d4dcf0abe62961b7aa55b467"
64
+ "version": "43.7.1",
65
+ "gitHead": "71d7fbccc5d96be760960eae95ded8410ed5a936"
66
66
  }