@wireapp/core 43.5.3 → 43.5.5
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/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +4 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +4 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.js +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.js +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.js +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.js +5 -3
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts +3 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.js +5 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.js +6 -6
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +7 -5
- package/package.json +4 -4
|
@@ -5,11 +5,11 @@ import { E2EIServiceExternal } from './E2EIServiceExternal';
|
|
|
5
5
|
* Proxy types relevant to the E2EIService from CoreCrypto
|
|
6
6
|
*/
|
|
7
7
|
type OmitFree<T> = Omit<T, 'free'>;
|
|
8
|
-
type NewAcmeAuthzOriginal = OmitFree<ReturnType<E2eiEnrollment['newAuthzResponse']
|
|
9
|
-
export type AcmeDirectory = OmitFree<ReturnType<E2eiEnrollment['directoryResponse']
|
|
8
|
+
type NewAcmeAuthzOriginal = OmitFree<Awaited<ReturnType<E2eiEnrollment['newAuthzResponse']>>>;
|
|
9
|
+
export type AcmeDirectory = OmitFree<Awaited<ReturnType<E2eiEnrollment['directoryResponse']>>>;
|
|
10
10
|
export type AcmeChallenge = OmitFree<NonNullable<NewAcmeAuthzOriginal['wireDpopChallenge']>>;
|
|
11
|
-
export type NewAcmeOrder = OmitFree<ReturnType<E2eiEnrollment['newOrderResponse']
|
|
12
|
-
export type NewAcmeAuthz = Pick<ReturnType<E2eiEnrollment['newAuthzResponse']
|
|
11
|
+
export type NewAcmeOrder = OmitFree<Awaited<ReturnType<E2eiEnrollment['newOrderResponse']>>>;
|
|
12
|
+
export type NewAcmeAuthz = Pick<Awaited<ReturnType<E2eiEnrollment['newAuthzResponse']>>, 'identifier'> & {
|
|
13
13
|
wireDpopChallenge?: AcmeChallenge;
|
|
14
14
|
wireOidcChallenge?: AcmeChallenge;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACnC,KAAK,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"E2EIService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2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AE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC;AACjC,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,UAAU,CAAC;IAC5B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EAKb,UAAU,EACV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAW7B,cAAM,mBAAmB;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAC9E,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAa;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACnC,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,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;;;;OAMG;YACW,iBAAiB;IAmB/B;;;;;OAKG;IACU,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO;CAkB5F;AAED,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
|
|
@@ -90,14 +90,13 @@ class E2EIServiceInternal {
|
|
|
90
90
|
}
|
|
91
91
|
// ############ Internal Functions ############
|
|
92
92
|
async initIdentity(hasActiveCertificate) {
|
|
93
|
-
const {
|
|
94
|
-
const e2eiClientId = (0, Helper_1.getE2EIClientId)(clientId, user.id, user.domain).asString;
|
|
93
|
+
const { user } = E2EIStorage_1.E2EIStorage.get.initialData();
|
|
95
94
|
// How long the issued certificate should be maximal valid
|
|
96
95
|
const expiryDays = 90;
|
|
97
96
|
const ciphersuite = E2EIService_types_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519;
|
|
98
97
|
if (hasActiveCertificate) {
|
|
99
98
|
try {
|
|
100
|
-
this.identity = await this.coreCryptoClient.e2eiNewRotateEnrollment(
|
|
99
|
+
this.identity = await this.coreCryptoClient.e2eiNewRotateEnrollment(expiryDays, ciphersuite, user.displayName, user.handle);
|
|
101
100
|
}
|
|
102
101
|
catch (error) {
|
|
103
102
|
this.logger.error('Error while trying to initIdentity e2eiNewRotateEnrollment', error);
|
|
@@ -105,7 +104,7 @@ class E2EIServiceInternal {
|
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
else {
|
|
108
|
-
this.identity = await this.coreCryptoClient.e2eiNewActivationEnrollment(
|
|
107
|
+
this.identity = await this.coreCryptoClient.e2eiNewActivationEnrollment(user.displayName, user.handle, expiryDays, ciphersuite);
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
exitWithError(message, error) {
|
|
@@ -218,6 +217,7 @@ class E2EIServiceInternal {
|
|
|
218
217
|
}
|
|
219
218
|
// Step 7: Do OIDC client challenge
|
|
220
219
|
const oidcData = await (0, OidcChallenge_1.doWireOidcChallenge)({
|
|
220
|
+
coreCryptoClient: this.coreCryptoClient,
|
|
221
221
|
oAuthIdToken,
|
|
222
222
|
authData,
|
|
223
223
|
connection: this.acmeService,
|
|
@@ -21,10 +21,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.createNewAccount = void 0;
|
|
22
22
|
const Helper_1 = require("../Helper");
|
|
23
23
|
const createNewAccount = async ({ nonce, connection, directory, identity, }) => {
|
|
24
|
-
const reqBody = identity.newAccountRequest(nonce);
|
|
24
|
+
const reqBody = await identity.newAccountRequest(nonce);
|
|
25
25
|
const response = await connection.createNewAccount(directory.newAccount, reqBody);
|
|
26
26
|
if ((response === null || response === void 0 ? void 0 : response.data) && !!response.data.status.length && !!response.nonce.length) {
|
|
27
|
-
identity.newAccountResponse((0, Helper_1.jsonToByteArray)(response.data));
|
|
27
|
+
await identity.newAccountResponse((0, Helper_1.jsonToByteArray)(response.data));
|
|
28
28
|
return response.nonce;
|
|
29
29
|
}
|
|
30
30
|
throw new Error('No account-data received');
|
|
@@ -21,10 +21,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.getAuthorization = void 0;
|
|
22
22
|
const Helper_1 = require("../Helper");
|
|
23
23
|
const getAuthorization = async ({ authzUrl, nonce, identity, connection, }) => {
|
|
24
|
-
const reqBody = identity.newAuthzRequest(authzUrl, nonce);
|
|
24
|
+
const reqBody = await identity.newAuthzRequest(authzUrl, nonce);
|
|
25
25
|
const response = await connection.getAuthorization(authzUrl, reqBody);
|
|
26
26
|
if ((response === null || response === void 0 ? void 0 : response.data) && !!response.data.status.length && !!response.nonce.length) {
|
|
27
|
-
const wasmData = identity.newAuthzResponse((0, Helper_1.jsonToByteArray)(response.data));
|
|
27
|
+
const wasmData = await identity.newAuthzResponse((0, Helper_1.jsonToByteArray)(response.data));
|
|
28
28
|
// manual copy of the wasm data because of a problem while cloning it
|
|
29
29
|
const authorization = {
|
|
30
30
|
identifier: wasmData.identifier,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.getCertificate = void 0;
|
|
22
22
|
const getCertificate = async ({ certificateUrl, connection, identity, nonce }) => {
|
|
23
|
-
const reqBody = identity.certificateRequest(nonce);
|
|
23
|
+
const reqBody = await identity.certificateRequest(nonce);
|
|
24
24
|
const certificateResponse = await connection.getCertificate(certificateUrl, reqBody);
|
|
25
25
|
if (certificateResponse === null || certificateResponse === void 0 ? void 0 : certificateResponse.data) {
|
|
26
26
|
return {
|
package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DpopChallenge.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DpopChallenge.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,yBAAyB,EAAmD,MAAM,uBAAuB,CAAC;AA6BlH,eAAO,MAAM,mBAAmB,4FAS7B,yBAAyB;;;;;;;;;EA+B3B,CAAC"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.doWireDpopChallenge = void 0;
|
|
22
|
+
const bazinga64_1 = require("bazinga64");
|
|
22
23
|
const getClientNonce = async ({ apiClient, clientId }) => {
|
|
23
24
|
try {
|
|
24
25
|
const nonce = await apiClient.api.client.getNonce(clientId);
|
|
@@ -32,10 +33,10 @@ const getClientNonce = async ({ apiClient, clientId }) => {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
const getClientAccessToken = async ({ apiClient, clientNonce, identity, clientId, expirySecs, }) => {
|
|
35
|
-
const dpopToken = identity.createDpopToken(expirySecs, clientNonce);
|
|
36
|
+
const dpopToken = await identity.createDpopToken(expirySecs, clientNonce);
|
|
36
37
|
// Remove this when the server is ready to accept the token
|
|
37
38
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
38
|
-
return
|
|
39
|
+
return apiClient.api.client.getAccessToken(clientId, dpopToken);
|
|
39
40
|
};
|
|
40
41
|
const doWireDpopChallenge = async ({ apiClient, clientId, authData, identity, nonce, connection, expirySecs, userDomain, }) => {
|
|
41
42
|
const { wireDpopChallenge } = authData.authorization;
|
|
@@ -53,11 +54,12 @@ const doWireDpopChallenge = async ({ apiClient, clientId, authData, identity, no
|
|
|
53
54
|
expirySecs,
|
|
54
55
|
userDomain,
|
|
55
56
|
});
|
|
56
|
-
const reqBody = identity.newDpopChallengeRequest(clientAccessTokenData.token, nonce);
|
|
57
|
+
const reqBody = await identity.newDpopChallengeRequest(clientAccessTokenData.token, nonce);
|
|
57
58
|
const dpopChallengeResponse = await connection.validateDpopChallenge(wireDpopChallenge.url, reqBody);
|
|
58
59
|
if (!dpopChallengeResponse) {
|
|
59
60
|
throw new Error('No response received while validating DPOP challenge');
|
|
60
61
|
}
|
|
62
|
+
await identity.newDpopChallengeResponse(bazinga64_1.Converter.stringToArrayBufferViewUTF8(JSON.stringify(dpopChallengeResponse.data)));
|
|
61
63
|
return dpopChallengeResponse;
|
|
62
64
|
};
|
|
63
65
|
exports.doWireDpopChallenge = doWireDpopChallenge;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { GetAuthorizationReturnValue } from './Authorization';
|
|
2
2
|
import { AcmeService } from '../Connection/AcmeServer';
|
|
3
|
-
import { E2eiEnrollment, Nonce } from '../E2EIService.types';
|
|
3
|
+
import { CoreCrypto, E2eiEnrollment, Nonce } from '../E2EIService.types';
|
|
4
4
|
interface DoWireOidcChallengeParams {
|
|
5
|
+
coreCryptoClient: CoreCrypto;
|
|
5
6
|
authData: GetAuthorizationReturnValue;
|
|
6
7
|
identity: E2eiEnrollment;
|
|
7
8
|
connection: AcmeService;
|
|
8
9
|
nonce: Nonce;
|
|
9
10
|
oAuthIdToken: string;
|
|
10
11
|
}
|
|
11
|
-
export declare const doWireOidcChallenge: ({ connection, authData, identity, nonce, oAuthIdToken, }: DoWireOidcChallengeParams) => Promise<{
|
|
12
|
+
export declare const doWireOidcChallenge: ({ coreCryptoClient, connection, authData, identity, nonce, oAuthIdToken, }: DoWireOidcChallengeParams) => Promise<{
|
|
12
13
|
data: {
|
|
13
14
|
type: string;
|
|
14
15
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcChallenge.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OidcChallenge.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,UAAU,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAEvE,UAAU,yBAAyB;IACjC,gBAAgB,EAAE,UAAU,CAAC;IAC7B,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,+EAO7B,yBAAyB;;;;;;;;;;;;;;;EAmB3B,CAAC"}
|
|
@@ -19,16 +19,19 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.doWireOidcChallenge = void 0;
|
|
22
|
-
const
|
|
22
|
+
const bazinga64_1 = require("bazinga64");
|
|
23
|
+
const doWireOidcChallenge = async ({ coreCryptoClient, connection, authData, identity, nonce, oAuthIdToken, }) => {
|
|
23
24
|
const { wireOidcChallenge } = authData.authorization;
|
|
24
25
|
if (!wireOidcChallenge) {
|
|
25
26
|
throw new Error('No wireOIDCChallenge defined');
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
+
const refreshToken = 'empty'; // CC just stores the refresh token (which we don't need for web, as our oidc library does that for us)
|
|
29
|
+
const reqBody = await identity.newOidcChallengeRequest(oAuthIdToken, refreshToken, nonce);
|
|
28
30
|
const oidcChallengeResponse = await connection.validateOidcChallenge(wireOidcChallenge.url, reqBody);
|
|
29
31
|
if (!oidcChallengeResponse) {
|
|
30
32
|
throw new Error('No response received while validating OIDC challenge');
|
|
31
33
|
}
|
|
34
|
+
await identity.newOidcChallengeResponse(coreCryptoClient, bazinga64_1.Converter.stringToArrayBufferViewUTF8(JSON.stringify(oidcChallengeResponse.data)));
|
|
32
35
|
return oidcChallengeResponse;
|
|
33
36
|
};
|
|
34
37
|
exports.doWireOidcChallenge = doWireOidcChallenge;
|
|
@@ -22,11 +22,11 @@ exports.finalizeOrder = exports.createNewOrder = void 0;
|
|
|
22
22
|
const Helper_1 = require("../Helper");
|
|
23
23
|
const createNewOrder = async ({ identity, nonce, directory, connection, }) => {
|
|
24
24
|
var _a;
|
|
25
|
-
const reqBody = identity.newOrderRequest(nonce);
|
|
25
|
+
const reqBody = await identity.newOrderRequest(nonce);
|
|
26
26
|
const response = await connection.createNewOrder(directory.newOrder, reqBody);
|
|
27
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
28
|
return {
|
|
29
|
-
order: identity.newOrderResponse((0, Helper_1.jsonToByteArray)(response.data)),
|
|
29
|
+
order: await identity.newOrderResponse((0, Helper_1.jsonToByteArray)(response.data)),
|
|
30
30
|
authzUrl: response.data.authorizations[0],
|
|
31
31
|
nonce: response.nonce,
|
|
32
32
|
orderUrl: response.location,
|
|
@@ -36,14 +36,14 @@ const createNewOrder = async ({ identity, nonce, directory, connection, }) => {
|
|
|
36
36
|
};
|
|
37
37
|
exports.createNewOrder = createNewOrder;
|
|
38
38
|
const finalizeOrder = async ({ identity, nonce, orderUrl, connection }) => {
|
|
39
|
-
const statusReqBody = identity.checkOrderRequest(orderUrl, nonce);
|
|
39
|
+
const statusReqBody = await identity.checkOrderRequest(orderUrl, nonce);
|
|
40
40
|
const statusResponse = await connection.checkStatusOfOrder(orderUrl, statusReqBody);
|
|
41
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);
|
|
42
|
+
const finalizeUrl = await identity.checkOrderResponse((0, Helper_1.jsonToByteArray)(statusResponse.data));
|
|
43
|
+
const finalizeReqBody = await identity.finalizeRequest(statusResponse.nonce);
|
|
44
44
|
const finalizeResponse = await connection.finalizeOrder(finalizeUrl, finalizeReqBody);
|
|
45
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));
|
|
46
|
+
const certificateUrl = await identity.finalizeResponse((0, Helper_1.jsonToByteArray)(finalizeResponse.data));
|
|
47
47
|
return {
|
|
48
48
|
certificateUrl,
|
|
49
49
|
nonce: finalizeResponse.nonce,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAq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C,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAcjF,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE;IASjF;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;CAiEpC"}
|
|
@@ -156,7 +156,9 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
156
156
|
});
|
|
157
157
|
if (!blockKeypackageUpload) {
|
|
158
158
|
// We need to make sure keypackages and public key are uploaded to the backend
|
|
159
|
-
|
|
159
|
+
if (typeof client.mls_public_keys.ed25519 !== 'string' || client.mls_public_keys.ed25519.length === 0) {
|
|
160
|
+
await this.uploadMLSPublicKeys(client);
|
|
161
|
+
}
|
|
160
162
|
await this.verifyRemoteMLSKeyPackagesAmount(client.id);
|
|
161
163
|
}
|
|
162
164
|
else {
|
|
@@ -478,9 +480,6 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
478
480
|
*/
|
|
479
481
|
async uploadMLSPublicKeys(client) {
|
|
480
482
|
// If we've already updated a client with its public key, there's no need to do it again.
|
|
481
|
-
if (typeof client.mls_public_keys.ed25519 === 'string' && client.mls_public_keys.ed25519.length > 0) {
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
483
|
const publicKey = await this.coreCryptoClient.clientPublicKey(this.config.cipherSuite);
|
|
485
484
|
return this.apiClient.api.client.putClient(client.id, {
|
|
486
485
|
mls_public_keys: { ed25519: btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(publicKey)) },
|
|
@@ -653,7 +652,10 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
653
652
|
}
|
|
654
653
|
if (rotateBundle !== undefined) {
|
|
655
654
|
// upload the clients public keys
|
|
656
|
-
|
|
655
|
+
if (!hasActiveCertificate) {
|
|
656
|
+
// we only upload public keys for the initial certification process. Renewals do not need to upload new public keys
|
|
657
|
+
await this.uploadMLSPublicKeys(client);
|
|
658
|
+
}
|
|
657
659
|
// Remove old key packages
|
|
658
660
|
await this.deleteMLSKeyPackages(client.id, rotateBundle.keyPackageRefsToRemove);
|
|
659
661
|
// Upload new key packages with x509 certificate
|
package/package.json
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^26.
|
|
14
|
+
"@wireapp/api-client": "^26.10.0",
|
|
15
15
|
"@wireapp/commons": "^5.2.4",
|
|
16
|
-
"@wireapp/core-crypto": "1.0.0-rc.
|
|
16
|
+
"@wireapp/core-crypto": "1.0.0-rc.23",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/promise-queue": "^2.2.9",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.44.0",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "43.5.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "43.5.5",
|
|
65
|
+
"gitHead": "eb0be3a353f326c7b9345b458511c4506523e25f"
|
|
66
66
|
}
|