Explicit ACI check for contact serviceId
This commit is contained in:
parent
80a19d39de
commit
00f0ccd900
1 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,7 @@ import {
|
||||||
SafetyNumberIdentifierType,
|
SafetyNumberIdentifierType,
|
||||||
SafetyNumberMode,
|
SafetyNumberMode,
|
||||||
} from '../types/safetyNumber';
|
} from '../types/safetyNumber';
|
||||||
|
import { isAciString } from '../types/ServiceId';
|
||||||
|
|
||||||
const ITERATION_COUNT = 5200;
|
const ITERATION_COUNT = 5200;
|
||||||
const E164_VERSION = 1;
|
const E164_VERSION = 1;
|
||||||
|
@ -37,8 +38,9 @@ export async function generateSafetyNumbers(
|
||||||
const us = storage.protocol.getIdentityRecord(ourAci);
|
const us = storage.protocol.getIdentityRecord(ourAci);
|
||||||
const ourKeyBuffer = us ? us.publicKey : null;
|
const ourKeyBuffer = us ? us.publicKey : null;
|
||||||
|
|
||||||
const theirAci =
|
const theirAci = isAciString(contact.serviceId)
|
||||||
contact.pni !== contact.serviceId ? contact.serviceId : undefined;
|
? contact.serviceId
|
||||||
|
: undefined;
|
||||||
const them = theirAci
|
const them = theirAci
|
||||||
? await storage.protocol.getOrMigrateIdentityRecord(theirAci)
|
? await storage.protocol.getOrMigrateIdentityRecord(theirAci)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
Loading…
Reference in a new issue