Use UUID-only sender certificate when applicable
This commit is contained in:
parent
cfd77bf968
commit
18ccda83ba
3 changed files with 70 additions and 25 deletions
|
@ -26,10 +26,7 @@ import {
|
|||
UnregisteredUserError,
|
||||
} from './Errors';
|
||||
import { isValidNumber } from '../types/PhoneNumber';
|
||||
import {
|
||||
SecretSessionCipher,
|
||||
SerializedCertificateType,
|
||||
} from '../metadata/SecretSessionCipher';
|
||||
import { SecretSessionCipher } from '../metadata/SecretSessionCipher';
|
||||
|
||||
type OutgoingMessageOptionsType = SendOptionsType & {
|
||||
online?: boolean;
|
||||
|
@ -62,8 +59,6 @@ export default class OutgoingMessage {
|
|||
|
||||
sendMetadata?: SendMetadataType;
|
||||
|
||||
senderCertificate?: SerializedCertificateType;
|
||||
|
||||
online?: boolean;
|
||||
|
||||
constructor(
|
||||
|
@ -96,9 +91,8 @@ export default class OutgoingMessage {
|
|||
this.failoverIdentifiers = [];
|
||||
this.unidentifiedDeliveries = [];
|
||||
|
||||
const { sendMetadata, senderCertificate, online } = options;
|
||||
const { sendMetadata, online } = options;
|
||||
this.sendMetadata = sendMetadata;
|
||||
this.senderCertificate = senderCertificate;
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
|
@ -344,12 +338,8 @@ export default class OutgoingMessage {
|
|||
} = {};
|
||||
const plaintext = this.getPlaintext();
|
||||
|
||||
const { sendMetadata, senderCertificate } = this;
|
||||
const info =
|
||||
sendMetadata && sendMetadata[identifier]
|
||||
? sendMetadata[identifier]
|
||||
: { accessKey: undefined };
|
||||
const { accessKey } = info;
|
||||
const { sendMetadata } = this;
|
||||
const { accessKey, senderCertificate } = sendMetadata?.[identifier] || {};
|
||||
|
||||
if (accessKey && !senderCertificate) {
|
||||
window.log.warn(
|
||||
|
@ -442,8 +432,8 @@ export default class OutgoingMessage {
|
|||
}
|
||||
|
||||
// This ensures that we don't hit this codepath the next time through
|
||||
if (info) {
|
||||
info.accessKey = undefined;
|
||||
if (sendMetadata) {
|
||||
delete sendMetadata[identifier];
|
||||
}
|
||||
|
||||
return this.doSendMessage(identifier, deviceIds, recurse);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue