mirror of
https://github.com/tlsnotary/PageSigner.git
synced 2026-01-08 22:27:57 -05:00
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.
32 lines
1021 B
JavaScript
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();
|
|
|