2015-09-07 23:53:43 +02:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-27 03:10:04 +01:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2015-03-06 00:25:49 +01:00
|
|
|
Whisper.KeyVerificationView = Whisper.View.extend({
|
2015-02-27 03:10:04 +01:00
|
|
|
className: 'key-verification',
|
2015-03-06 00:25:49 +01:00
|
|
|
template: $('#key-verification').html(),
|
2015-02-27 03:10:04 +01:00
|
|
|
events: {
|
|
|
|
'click .back': 'goBack'
|
|
|
|
},
|
|
|
|
goBack: function() {
|
|
|
|
this.trigger('back');
|
|
|
|
},
|
|
|
|
splitKey: function(key) {
|
2015-07-16 20:06:05 +02: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 03:10:04 +01:00
|
|
|
|
2015-07-16 20:06:05 +02:00
|
|
|
return octets;
|
2015-02-27 03:10:04 +01:00
|
|
|
},
|
2015-03-07 02:05:36 +01:00
|
|
|
render_attributes: function() {
|
2015-03-06 00:25:49 +01:00
|
|
|
return {
|
2015-02-27 03:10:04 +01:00
|
|
|
your_key: this.splitKey(this.model.your_key),
|
|
|
|
their_key: this.splitKey(this.model.their_key)
|
2015-03-06 00:25:49 +01:00
|
|
|
};
|
2015-02-27 03:10:04 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|