Include and process destinationPniIdentityKey

This commit is contained in:
Fedor Indutny 2024-03-11 18:08:38 -07:00 committed by GitHub
parent 711e321d16
commit e031d136a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 238 additions and 214 deletions

View file

@ -136,6 +136,11 @@ export type SessionTransactionOptions = Readonly<{
zone?: Zone;
}>;
export type SaveIdentityOptions = Readonly<{
zone?: Zone;
noOverwrite?: boolean;
}>;
export type VerifyAlternateIdentityOptionsType = Readonly<{
aci: AciString;
pni: PniString;
@ -2049,7 +2054,7 @@ export class SignalProtocolStore extends EventEmitter {
encodedAddress: Address,
publicKey: Uint8Array,
nonblockingApproval = false,
{ zone = GLOBAL_ZONE }: SessionTransactionOptions = {}
{ zone = GLOBAL_ZONE, noOverwrite = false }: SaveIdentityOptions = {}
): Promise<boolean> {
if (!this.identityKeys) {
throw new Error('saveIdentity: this.identityKeys not yet cached!');
@ -2100,6 +2105,10 @@ export class SignalProtocolStore extends EventEmitter {
return false;
}
if (noOverwrite) {
return false;
}
const identityKeyChanged = !constantTimeEqual(
identityRecord.publicKey,
publicKey