UUID-keyed lookups in SignalProtocolStore

This commit is contained in:
Fedor Indutny 2021-09-09 19:38:11 -07:00 committed by GitHub
parent 6323aedd9b
commit c7e7d55af4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 2094 additions and 1447 deletions

View file

@ -550,19 +550,12 @@ function buildGroupProto(
);
}
const me = window.ConversationController.get(ourConversationId);
if (!me) {
throw new Error(
`buildGroupProto/${logId}: unable to find our own conversation!`
);
}
const ourUuid = window.storage.user.getCheckedUuid();
const ourUuid = me.get('uuid');
if (!ourUuid) {
throw new Error(`buildGroupProto/${logId}: unable to find our own uuid!`);
}
const ourUuidCipherTextBuffer = encryptUuid(clientZkGroupCipher, ourUuid);
const ourUuidCipherTextBuffer = encryptUuid(
clientZkGroupCipher,
ourUuid.toString()
);
proto.membersPendingProfileKey = (attributes.pendingMembersV2 || []).map(
item => {
@ -627,15 +620,11 @@ export async function buildAddMembersChange(
);
const clientZkGroupCipher = getClientZkGroupCipher(secretParams);
const ourConversationId = window.ConversationController.getOurConversationIdOrThrow();
const ourConversation = window.ConversationController.get(ourConversationId);
const ourUuid = ourConversation?.get('uuid');
if (!ourUuid) {
throw new Error(
`buildAddMembersChange/${logId}: unable to find our own UUID!`
);
}
const ourUuidCipherTextBuffer = encryptUuid(clientZkGroupCipher, ourUuid);
const ourUuid = window.storage.user.getCheckedUuid();
const ourUuidCipherTextBuffer = encryptUuid(
clientZkGroupCipher,
ourUuid.toString()
);
const now = Date.now();
@ -1727,10 +1716,12 @@ export async function createGroupV2({
timestamp,
});
const ourUuid = window.storage.user.getCheckedUuid();
const createdTheGroupMessage: MessageAttributesType = {
...generateBasicMessage(),
type: 'group-v2-change',
sourceUuid: conversation.ourUuid,
sourceUuid: ourUuid.toString(),
conversationId: conversation.id,
received_at: window.Signal.Util.incrementMessageCounter(),
received_at_ms: timestamp,