Support for sending and receiving verification sync messages

This adds a new method to message sender for sending verification sync messages
and a new event to message receiver representing incoming verification sync
messages. Currently the event handler just logs the message.

// FREEBIE
This commit is contained in:
lilia 2017-06-15 15:00:04 -07:00 committed by Scott Nonnenberg
parent 475d607fd0
commit 52481d1d13
4 changed files with 88 additions and 1 deletions

View file

@ -119,7 +119,7 @@
messageReceiver.addEventListener('group', onGroupReceived);
messageReceiver.addEventListener('sent', onSentMessage);
messageReceiver.addEventListener('read', onReadReceipt);
// messageReceiver.addEventListener('verify', onVerify);
messageReceiver.addEventListener('verification', onVerify);
messageReceiver.addEventListener('error', onError);
@ -326,6 +326,29 @@
});
}
function onVerification(ev) {
var state;
switch(ev.state) {
case textsecure.protobuf.Verification.State.DEFAULT:
state = 'DEFAULT';
break;
case textsecure.protobuf.Verification.State.VERIFIED:
state = 'VERIFIED';
break;
case textsecure.protobuf.Verification.State.NO_LONGER_VERIFIED:
state = 'UNVERIFIED';
break;
}
console.log('got verification sync for', ev.destination, state);
/* TODO
processVerifiedMessage(
textsecure.storage.protocol.VerifiedStatus[state],
ev.destination,
ev.identityKey
);
*/
}
window.owsDesktopApp = {
getAppView: function(destWindow) {