This repository has been archived on 2021-02-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
offpass-desktop/src/index.html
Nicolas 48c40a5d93 + Add a two new libraries
+ QR-Code is now readable and decryptable
2019-10-25 16:02:37 +02:00

61 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oxygen:700&display=swap" rel="stylesheet">
<link href="assets/fontawesome-5.11.2/css/all.css" rel="stylesheet">
<script type="text/javascript" src="assets/instascan.min.js"></script>
<link href="global.css" rel="stylesheet">
<link href="scanner.css" rel="stylesheet">
</head>
<body>
<div id="taskbar">
<div class="fill"></div>
<i id="mini" class="fas fa-window-minimize" onclick="remote.BrowserWindow.getFocusedWindow().minimize()"></i>
<i id="close" class="fas fa-times" onclick="remote.BrowserWindow.getFocusedWindow().close()"></i>
</div>
<div id="content">
<!--<h1>Welcome to OffPass</h1>
<p>In this short tutorial you'll learn how to use this software.</p>
<a href="#">Let's start</a>-->
<video id="preview"></video>
</div>
<script>
const { remote } = require('electron');
const pgp = require('openpgp');
navigator.mediaDevices.getUserMedia({video: true});
const preview = document.getElementById('preview');
let scanner = new Instascan.Scanner({ video: preview, mirror: false });
scanner.addListener('scan', async (content) => {
content = "-----BEGIN PGP MESSAGE-----\n\n" + content + "\n-----END PGP MESSAGE-----";
console.log(content)
pgp.decrypt({
message: await pgp.message.readArmored(content),
passwords: [ '123' ],
format: 'string'
}).then((plaintext) => {
console.log(plaintext.data);
});
});
Instascan.Camera.getCameras().then(function (cameras) {
if (cameras.length > 0) {
scanner.start(cameras[0]);
navigator.mediaDevices.getUserMedia({video: true}).then((stream) => {
preview.srcObject = stream;
})
} else {
console.error('No cameras found.');
}
}).catch(function (e) {
console.error(e);
});
</script>
</body>
</html>