2015-09-07 14:53:43 -07:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-26 18:10:04 -08:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2015-03-05 15:25:49 -08:00
|
|
|
Whisper.KeyVerificationView = Whisper.View.extend({
|
2016-03-23 12:33:50 -07:00
|
|
|
className: 'key-verification',
|
|
|
|
templateName: 'key_verification',
|
2015-02-26 18:10:04 -08:00
|
|
|
splitKey: function(key) {
|
2015-07-16 11:06:05 -07: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-26 18:10:04 -08:00
|
|
|
|
2015-07-16 11:06:05 -07:00
|
|
|
return octets;
|
2015-02-26 18:10:04 -08:00
|
|
|
},
|
2015-03-06 17:05:36 -08:00
|
|
|
render_attributes: function() {
|
2016-01-19 19:01:47 -08:00
|
|
|
return {
|
2016-03-24 12:33:41 -07:00
|
|
|
learnMore : i18n('learnMore'),
|
2015-12-25 17:16:36 -08:00
|
|
|
verifyIdentity: i18n('verifyIdentity'),
|
2016-01-17 23:41:45 +02:00
|
|
|
yourIdentity: i18n('yourIdentity'),
|
|
|
|
theirIdentity: i18n('theirIdentity'),
|
2016-01-19 19:01:47 -08:00
|
|
|
their_key_unknown: i18n('theirIdentityUnknown'),
|
2015-02-26 18:10:04 -08:00
|
|
|
your_key: this.splitKey(this.model.your_key),
|
2016-03-21 18:18:10 -07:00
|
|
|
their_key: this.splitKey(this.model.their_key),
|
|
|
|
has_their_key: this.model.their_key !== undefined
|
2015-03-05 15:25:49 -08:00
|
|
|
};
|
2015-02-26 18:10:04 -08:00
|
|
|
}
|
|
|
|
});
|
2016-03-23 12:33:50 -07:00
|
|
|
Whisper.KeyVerificationPanelView = Whisper.KeyVerificationView.extend({
|
|
|
|
className: 'key-verification panel',
|
|
|
|
templateName: 'key_verification_panel',
|
|
|
|
});
|
2015-02-26 18:10:04 -08:00
|
|
|
})();
|