Sort sender key devices for future optimization
This commit is contained in:
parent
75f0cd50be
commit
784e5d5eee
1 changed files with 14 additions and 3 deletions
|
@ -841,9 +841,20 @@ async function encryptForSenderKey({
|
||||||
groupIdBuffer
|
groupIdBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
const recipients = devices.map(device =>
|
const recipients = devices
|
||||||
ProtocolAddress.new(device.identifier, device.id)
|
.slice()
|
||||||
);
|
.sort((a, b): number => {
|
||||||
|
if (a.identifier === b.identifier) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.identifier < b.identifier) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
.map(device => ProtocolAddress.new(device.identifier, device.id));
|
||||||
const identityKeyStore = new IdentityKeys();
|
const identityKeyStore = new IdentityKeys();
|
||||||
const sessionStore = new Sessions();
|
const sessionStore = new Sessions();
|
||||||
return sealedSenderMultiRecipientEncrypt(
|
return sealedSenderMultiRecipientEncrypt(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue