@wireapp/core 39.0.1 → 39.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageService.d.ts","sourceRoot":"","sources":["../../../src/conversation/message/MessageService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAOvF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKrE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAArD,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAElG;;;;;;;;;;;OAWG;IACU,WAAW,CACtB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,EAC/D,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,cAAc,CAAC,EAAE,WAAW,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAC;QACxC,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACrF,GACL,OAAO,CAAC,oBAAoB,GAAG;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;YAwBzC,cAAc;IAiE5B,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;OAOG;YACW,sBAAsB;
|
|
1
|
+
{"version":3,"file":"MessageService.d.ts","sourceRoot":"","sources":["../../../src/conversation/message/MessageService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAOvF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKrE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAArD,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAElG;;;;;;;;;;;OAWG;IACU,WAAW,CACtB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,EAC/D,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,cAAc,CAAC,EAAE,WAAW,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAC;QACxC,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACrF,GACL,OAAO,CAAC,oBAAoB,GAAG;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;YAwBzC,cAAc;IAiE5B,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;OAOG;YACW,sBAAsB;CAsBrC"}
|
|
@@ -133,7 +133,12 @@ class MessageService {
|
|
|
133
133
|
if (Object.keys(mismatch.missing).length) {
|
|
134
134
|
const { payloads } = await this.proteusService.encrypt(plainText, mismatch.missing);
|
|
135
135
|
const reEncryptedPayloads = (0, UserClientsUtil_1.flattenQualifiedUserClients)(payloads);
|
|
136
|
-
reEncryptedPayloads.forEach(({ data, userId }) =>
|
|
136
|
+
reEncryptedPayloads.forEach(({ data, userId }) => {
|
|
137
|
+
var _a;
|
|
138
|
+
const domainRecipients = (_a = recipients[userId.domain]) !== null && _a !== void 0 ? _a : {};
|
|
139
|
+
domainRecipients[userId.id] = Object.assign(Object.assign({}, domainRecipients[userId.id]), data);
|
|
140
|
+
recipients[userId.domain] = domainRecipients;
|
|
141
|
+
});
|
|
137
142
|
}
|
|
138
143
|
return recipients;
|
|
139
144
|
}
|
|
@@ -134,6 +134,30 @@ describe('MessageService', () => {
|
|
|
134
134
|
failed_to_send: {},
|
|
135
135
|
time: new Date().toISOString(),
|
|
136
136
|
};
|
|
137
|
+
it('handles client mismatch when no other clients from that domain are known', async () => {
|
|
138
|
+
const [messageService, { apiClient }] = await buildMessageService();
|
|
139
|
+
let spyCounter = 0;
|
|
140
|
+
const clientMismatch = Object.assign(Object.assign({}, baseClientMismatch), { missing: { [user1.domain]: { [user1.id]: ['client'] } } });
|
|
141
|
+
jest.spyOn(apiClient.api.conversation, 'postOTRMessage').mockImplementation(() => {
|
|
142
|
+
spyCounter++;
|
|
143
|
+
if (spyCounter === 1) {
|
|
144
|
+
const error = new Error();
|
|
145
|
+
error.response = {
|
|
146
|
+
status: http_status_codes_1.StatusCodes.PRECONDITION_FAILED,
|
|
147
|
+
data: clientMismatch,
|
|
148
|
+
};
|
|
149
|
+
return Promise.reject(error);
|
|
150
|
+
}
|
|
151
|
+
return Promise.resolve(baseClientMismatch);
|
|
152
|
+
});
|
|
153
|
+
jest.spyOn(apiClient.api.user, 'postMultiPreKeyBundles').mockReturnValue(Promise.resolve({}));
|
|
154
|
+
const recipients = generateRecipients([]);
|
|
155
|
+
await messageService.sendMessage('senderclientid', recipients, new Uint8Array(), {
|
|
156
|
+
reportMissing: true,
|
|
157
|
+
conversationId: { id: 'convid', domain: '' },
|
|
158
|
+
});
|
|
159
|
+
expect(apiClient.api.conversation.postOTRMessage).toHaveBeenCalledTimes(2);
|
|
160
|
+
});
|
|
137
161
|
it('handles client mismatch internally if no onClientMismatch is given', async () => {
|
|
138
162
|
const [messageService, { apiClient }] = await buildMessageService();
|
|
139
163
|
let spyCounter = 0;
|
package/package.json
CHANGED