2015-09-07 21:53:43 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-27 02:10:04 +00:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2015-03-05 23:25:49 +00:00
|
|
|
Whisper.KeyVerificationView = Whisper.View.extend({
|
2015-02-27 02:10:04 +00:00
|
|
|
className: 'key-verification',
|
2015-12-08 23:01:29 +00:00
|
|
|
templateName: 'key-verification',
|
2015-02-27 02:10:04 +00:00
|
|
|
events: {
|
|
|
|
'click .back': 'goBack'
|
|
|
|
},
|
|
|
|
goBack: function() {
|
|
|
|
this.trigger('back');
|
|
|
|
},
|
|
|
|
splitKey: function(key) {
|
2015-07-16 18:06:05 +00:00
|
|
|
// key is an array buffer
|
|
|
|
var bytes = new Uint8Array(key);
|
|
|
|
var octets = [];
|
|
|
|
for (var i = 0; i < bytes.byteLength; ++i) {
|
|
|
|
octets.push(('0' + bytes[i].toString(16)).slice(-2));
|
|
|
|
}
|
2015-02-27 02:10:04 +00:00
|
|
|
|
2015-07-16 18:06:05 +00:00
|
|
|
return octets;
|
2015-02-27 02:10:04 +00:00
|
|
|
},
|
2015-03-07 01:05:36 +00:00
|
|
|
render_attributes: function() {
|
2016-01-18 00:18:55 +00:00
|
|
|
var attributes = {
|
2015-12-26 01:16:36 +00:00
|
|
|
verifyIdentity: i18n('verifyIdentity'),
|
2016-01-17 21:41:45 +00:00
|
|
|
yourIdentity: i18n('yourIdentity'),
|
|
|
|
theirIdentity: i18n('theirIdentity'),
|
2015-02-27 02:10:04 +00:00
|
|
|
your_key: this.splitKey(this.model.your_key),
|
2015-03-05 23:25:49 +00:00
|
|
|
};
|
2016-01-18 00:18:55 +00:00
|
|
|
if(this.model.their_key) {
|
|
|
|
attributes.their_key = this.splitKey(this.model.their_key);
|
|
|
|
} else {
|
|
|
|
attributes.their_key_unknown = i18n('theirIdentityUnknown');
|
|
|
|
}
|
|
|
|
return attributes;
|
2015-02-27 02:10:04 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|