|
|
|
@ -1531,78 +1531,6 @@
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getSendOptions(options = {}) {
|
|
|
|
|
const senderCertificate = storage.get('senderCertificate');
|
|
|
|
|
const numberInfo = this.getNumberInfo(options);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
senderCertificate,
|
|
|
|
|
numberInfo,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getNumberInfo(options = {}) {
|
|
|
|
|
const { syncMessage, disableMeCheck } = options;
|
|
|
|
|
|
|
|
|
|
if (!this.ourNumber) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// START: this code has an Expiration date of ~2018/11/21
|
|
|
|
|
// We don't want to enable unidentified delivery for send unless it is
|
|
|
|
|
// also enabled for our own account.
|
|
|
|
|
const me = ConversationController.getOrCreate(this.ourNumber, 'private');
|
|
|
|
|
if (
|
|
|
|
|
!disableMeCheck &&
|
|
|
|
|
me.get('sealedSender') === SEALED_SENDER.DISABLED
|
|
|
|
|
) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
// END
|
|
|
|
|
|
|
|
|
|
if (!this.isPrivate()) {
|
|
|
|
|
const infoArray = this.contactCollection.map(conversation =>
|
|
|
|
|
conversation.getNumberInfo(options)
|
|
|
|
|
);
|
|
|
|
|
return Object.assign({}, ...infoArray);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const accessKey = this.get('accessKey');
|
|
|
|
|
const sealedSender = this.get('sealedSender');
|
|
|
|
|
|
|
|
|
|
// We never send sync messages as sealed sender
|
|
|
|
|
if (syncMessage && this.id === this.ourNumber) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we've never fetched user's profile, we default to what we have
|
|
|
|
|
if (sealedSender === SEALED_SENDER.UNKNOWN) {
|
|
|
|
|
return {
|
|
|
|
|
[this.id]: {
|
|
|
|
|
accessKey:
|
|
|
|
|
accessKey ||
|
|
|
|
|
window.Signal.Crypto.arrayBufferToBase64(
|
|
|
|
|
window.Signal.Crypto.getRandomBytes(16)
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sealedSender === SEALED_SENDER.DISABLED) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
[this.id]: {
|
|
|
|
|
accessKey:
|
|
|
|
|
accessKey && sealedSender === SEALED_SENDER.ENABLED
|
|
|
|
|
? accessKey
|
|
|
|
|
: window.Signal.Crypto.arrayBufferToBase64(
|
|
|
|
|
window.Signal.Crypto.getRandomBytes(16)
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
async updateSwarmNodes(swarmNodes) {
|
|
|
|
|
this.set({ swarmNodes });
|
|
|
|
|
await window.Signal.Data.updateConversation(this.id, this.attributes, {
|
|
|
|
|