UUID-keyed lookups in SignalProtocolStore
This commit is contained in:
parent
6323aedd9b
commit
c7e7d55af4
46 changed files with 2094 additions and 1447 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import { PublicKey, Fingerprint } from '@signalapp/signal-client';
|
||||
import { ConversationType } from '../state/ducks/conversations';
|
||||
import { UUID } from '../types/UUID';
|
||||
|
||||
import { assert } from './assert';
|
||||
|
||||
|
@ -33,16 +34,18 @@ export async function generateSecurityNumber(
|
|||
export async function generateSecurityNumberBlock(
|
||||
contact: ConversationType
|
||||
): Promise<Array<string>> {
|
||||
const ourNumber = window.textsecure.storage.user.getNumber();
|
||||
const ourUuid = window.textsecure.storage.user.getUuid();
|
||||
const { storage } = window.textsecure;
|
||||
const ourNumber = storage.user.getNumber();
|
||||
const ourUuid = storage.user.getCheckedUuid();
|
||||
|
||||
const us = window.textsecure.storage.protocol.getIdentityRecord(
|
||||
ourUuid || ourNumber || ''
|
||||
);
|
||||
const us = storage.protocol.getIdentityRecord(ourUuid);
|
||||
const ourKey = us ? us.publicKey : null;
|
||||
|
||||
const them = window.textsecure.storage.protocol.getIdentityRecord(contact.id);
|
||||
const theirKey = them ? them.publicKey : null;
|
||||
const theirUuid = UUID.lookup(contact.id);
|
||||
const them = theirUuid
|
||||
? await storage.protocol.getOrMigrateIdentityRecord(theirUuid)
|
||||
: undefined;
|
||||
const theirKey = them?.publicKey;
|
||||
|
||||
if (!ourKey) {
|
||||
throw new Error('Could not load our key');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue