You've already forked matrix-js-sdk
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:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user