Passive UUID support

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Ken Powers 2020-03-05 13:14:58 -08:00 committed by Scott Nonnenberg
parent f64ca0ed21
commit a90246cbe5
49 changed files with 2226 additions and 776 deletions

View file

@ -26,7 +26,7 @@
this.contactView = null;
}
const isMe = this.ourNumber === this.model.id;
const isMe = this.model.isMe();
this.contactView = new Whisper.ReactWrapperView({
className: 'contact-wrapper',
@ -47,7 +47,7 @@
return this;
},
showIdentity() {
if (this.model.id === this.ourNumber || this.loading) {
if (this.model.isMe() || this.loading) {
return;
}

View file

@ -2004,7 +2004,7 @@
await contact.setApproved();
}
message.resend(contact.id);
message.resend(contact.get('e164'), contact.get('uuid'));
},
});
@ -2483,6 +2483,7 @@
try {
await this.model.sendReactionMessage(reaction, {
targetAuthorE164: messageModel.getSource(),
targetAuthorUuid: messageModel.getSourceUuid(),
targetTimestamp: messageModel.get('sent_at'),
});
} catch (error) {
@ -2668,10 +2669,17 @@
if (window.reduxStore.getState().expiration.hasExpired) {
ToastView = Whisper.ExpiredToast;
}
if (this.model.isPrivate() && storage.isBlocked(this.model.id)) {
if (
this.model.isPrivate() &&
(storage.isBlocked(this.model.get('e164')) ||
storage.isUuidBlocked(this.model.get('uuid')))
) {
ToastView = Whisper.BlockedToast;
}
if (!this.model.isPrivate() && storage.isGroupBlocked(this.model.id)) {
if (
!this.model.isPrivate() &&
storage.isGroupBlocked(this.model.get('groupId'))
) {
ToastView = Whisper.BlockedGroupToast;
}
if (!this.model.isPrivate() && this.model.get('left')) {

View file

@ -16,6 +16,7 @@
},
initialize(options) {
this.ourNumber = textsecure.storage.user.getNumber();
this.ourUuid = textsecure.storage.user.getUuid();
if (options.newKey) {
this.theirKey = options.newKey;
}
@ -44,16 +45,29 @@
);
},
loadTheirKey() {
const item = textsecure.storage.protocol.identityKeys[this.model.id];
const item = textsecure.storage.protocol.getIdentityRecord(
this.model.get('id')
);
this.theirKey = item ? item.publicKey : null;
},
loadOurKey() {
const item = textsecure.storage.protocol.identityKeys[this.ourNumber];
const item = textsecure.storage.protocol.getIdentityRecord(
this.ourUuid || this.ourNumber
);
this.ourKey = item ? item.publicKey : null;
},
generateSecurityNumber() {
return new libsignal.FingerprintGenerator(5200)
.createFor(this.ourNumber, this.ourKey, this.model.id, this.theirKey)
.createFor(
// TODO: we cannot use UUIDs for safety numbers yet
// this.ourUuid || this.ourNumber,
this.ourNumber,
this.ourKey,
// TODO: we cannot use UUIDs for safety numbers yet
// this.model.get('uuid') || this.model.get('e164'),
this.model.get('e164'),
this.theirKey
)
.then(securityNumber => {
this.securityNumber = securityNumber;
});