Sender Key: Track registrationIds in senderKeyState

This commit is contained in:
Scott Nonnenberg 2021-07-30 11:35:25 -07:00 committed by GitHub
parent 689542a9b4
commit 9fb8114691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 15 deletions

View file

@ -967,13 +967,17 @@ export class SignalProtocolStore extends EventsMixin {
conversationIds.has(session.fromDB.conversationId)
);
const openEntries: Array<
SessionCacheEntry | undefined
| undefined
| {
entry: SessionCacheEntry;
record: SessionRecord;
}
> = await Promise.all(
entries.map(async entry => {
if (entry.hydrated) {
const record = entry.item;
if (record.hasCurrentState()) {
return entry;
return { record, entry };
}
return undefined;
@ -981,7 +985,7 @@ export class SignalProtocolStore extends EventsMixin {
const record = await this._maybeMigrateSession(entry.fromDB);
if (record.hasCurrentState()) {
return entry;
return { record, entry };
}
return undefined;
@ -989,10 +993,11 @@ export class SignalProtocolStore extends EventsMixin {
);
const devices = openEntries
.map(entry => {
if (!entry) {
.map(item => {
if (!item) {
return undefined;
}
const { entry, record } = item;
const { conversationId } = entry.fromDB;
conversationIds.delete(conversationId);
@ -1015,9 +1020,12 @@ export class SignalProtocolStore extends EventsMixin {
);
}
const registrationId = record.remoteRegistrationId();
return {
identifier,
id,
registrationId,
};
})
.filter(isNotNil);