mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-07-08 14:24:14 +01:00
Add isBlocking/isNonBlockingApprovalRequired
These analyse the identity key record and user preferences to determine whether a key requires approval for sending. // FREEBIE
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
;(function() {
|
||||
'use strict';
|
||||
var TIMESTAMP_THRESHOLD = 5 * 1000; // 5 seconds
|
||||
|
||||
var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__;
|
||||
var StaticArrayBufferProto = new ArrayBuffer().__proto__;
|
||||
@@ -343,6 +344,16 @@
|
||||
});
|
||||
});
|
||||
},
|
||||
isBlockingApprovalRequired: function(identityKey) {
|
||||
return (!identityKey.get('firstUse')
|
||||
&& storage.get('safety-numbers-approval', true)
|
||||
&& !identityKey.get('blockingApproval'));
|
||||
},
|
||||
isNonBlockingApprovalRequired: function(identityKey) {
|
||||
return (!identityKey.get('firstUse')
|
||||
&& Date.now() - identityKey.get('timestamp') < TIMESTAMP_THRESHOLD
|
||||
&& !identityKey.get('nonblockingApproval'));
|
||||
},
|
||||
removeIdentityKey: function(number) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var identityKey = new IdentityKey({id: number});
|
||||
|
||||
Reference in New Issue
Block a user