1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Simplify encryptAndSendToDevices (#2566)

It went to quite a lot of effort to gather a bunch of information to
return, but the only thing using it already had all that info anyway.
This commit is contained in:
David Baker
2022-08-05 15:58:33 +01:00
committed by GitHub
parent 7b7f8c1592
commit 575b416856
3 changed files with 9 additions and 28 deletions

View File

@@ -606,19 +606,19 @@ class MegolmEncryption extends EncryptionAlgorithm {
private encryptAndSendKeysToDevices(
session: OutboundSessionInfo,
chainIndex: number,
userDeviceMap: IOlmDevice[],
devices: IOlmDevice[],
payload: IPayload,
): Promise<void> {
return this.crypto.encryptAndSendToDevices(
userDeviceMap,
devices,
payload,
).then(({ toDeviceBatch, deviceInfoByUserIdAndDeviceId }) => {
).then(() => {
// store that we successfully uploaded the keys of the current slice
for (const msg of toDeviceBatch.batch) {
for (const device of devices) {
session.markSharedWithDevice(
msg.userId,
msg.deviceId,
deviceInfoByUserIdAndDeviceId.get(msg.userId).get(msg.deviceId).getIdentityKey(),
device.userId,
device.deviceInfo.deviceId,
device.deviceInfo.getIdentityKey(),
chainIndex,
);
}