Implement non blocking option
// FREEBIE
This commit is contained in:
parent
ce315f3f8e
commit
aa42139477
1 changed files with 20 additions and 3 deletions
|
@ -261,9 +261,26 @@
|
|||
var identityKey = new IdentityKey({id: number});
|
||||
identityKey.fetch().always(function() {
|
||||
var oldpublicKey = identityKey.get('publicKey');
|
||||
resolve(!oldpublicKey || equalArrayBuffers(oldpublicKey, publicKey));
|
||||
});
|
||||
});
|
||||
var matches = equalArrayBuffers(oldpublicKey, publicKey);
|
||||
var changed = !!oldpublicKey && !matches;
|
||||
if (changed) {
|
||||
console.log('Key changed for', identifier);
|
||||
this.trigger('keychange', identifier);
|
||||
}
|
||||
var trusted = !oldpublicKey || matches;
|
||||
if (trusted) {
|
||||
resolve(true);
|
||||
} else if (!storage.get('safety-numbers-approval', true)) {
|
||||
this.removeIdentityKey(identifier).then(function() {
|
||||
this.saveIdentity(identifier, publicKey).then(function() {
|
||||
resolve(true);
|
||||
});
|
||||
}.bind(this));
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
},
|
||||
loadIdentityKey: function(identifier) {
|
||||
if (identifier === null || identifier === undefined) {
|
||||
|
|
Loading…
Reference in a new issue