Unwrap removeIdentityKey from calls to saveIdentity
saveIdentity is now reponsible for determining firstUse, so we must not remove the existing key before updating it. Previously, the implementation provided an extra check against overwritting an existing key, but that should be done via isTrustedIdentity instead. // FREEBIE
This commit is contained in:
@@ -504,7 +504,6 @@
|
|||||||
throw 'No conflicts to resolve';
|
throw 'No conflicts to resolve';
|
||||||
}
|
}
|
||||||
|
|
||||||
return textsecure.storage.protocol.removeIdentityKey(number).then(function() {
|
|
||||||
return textsecure.storage.protocol.saveIdentity(number, identityKey).then(function() {
|
return textsecure.storage.protocol.saveIdentity(number, identityKey).then(function() {
|
||||||
var promise = Promise.resolve();
|
var promise = Promise.resolve();
|
||||||
var conflicts = this.messageCollection.filter(function(message) {
|
var conflicts = this.messageCollection.filter(function(message) {
|
||||||
@@ -524,7 +523,6 @@
|
|||||||
});
|
});
|
||||||
return promise;
|
return promise;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
|
||||||
},
|
},
|
||||||
notify: function(message) {
|
notify: function(message) {
|
||||||
if (!message.isIncoming()) {
|
if (!message.isIncoming()) {
|
||||||
|
@@ -293,13 +293,11 @@
|
|||||||
if (!oldpublicKey || equalArrayBuffers(oldpublicKey, publicKey)) {
|
if (!oldpublicKey || equalArrayBuffers(oldpublicKey, publicKey)) {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else if (!storage.get('safety-numbers-approval', true)) {
|
} else if (!storage.get('safety-numbers-approval', true)) {
|
||||||
this.removeIdentityKey(identifier).then(function() {
|
|
||||||
this.saveIdentity(identifier, publicKey).then(function() {
|
this.saveIdentity(identifier, publicKey).then(function() {
|
||||||
console.log('Key changed for', identifier);
|
console.log('Key changed for', identifier);
|
||||||
this.trigger('keychange', identifier);
|
this.trigger('keychange', identifier);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
|
||||||
} else {
|
} else {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user