Files
PageSigner/ui/DetailsViewer.js
themighty1 bb1cd756cd feat: allow to preview notarization.
Often the user may want to see what the notarization result will look like without
spending time on the 2PC protocol. This adds a "Preview" menu item to allow to do that.
2022-03-08 16:30:30 +03:00

32 lines
1021 B
JavaScript

/* global chrome*/
import {decode_str} from './utils.js';
// DetailsViewer show session details: raw request, response, notarization time
class DetailsViewer{
constructor(){
window.tabid = null; // allow the extension to put the id of the tab which opened this page
window.isDetailsViewer = true;
// isReady will be se to true after message listener is installed
window.isReady = false;
}
main(){
chrome.runtime.onMessage.addListener(function(obj) {
if (obj.destination !== 'detailsViewer') return;
console.log('got obj', obj);
if (obj.tabId != window.tabid) return;
document.getElementById('request').textContent = decode_str(obj.request);
document.getElementById('response').textContent = decode_str(obj.response);
if (obj.sessionId != undefined){
document.getElementById('notarization_time').textContent = obj.sessionId;
}
});
window.isReady = true;
}
}
window.detailsViewer = new DetailsViewer();
window.detailsViewer.main();