Commit 5958ec5d authored by bpresles's avatar bpresles
Browse files

Added a private QRCode generator to ease the identification for FieliG1 professional users

parent e0c753b0
<?php
$mytime = new Datetime("now");
$timestamp = $mytime->format('U').rand();
$privkey_shell = escapeshellcmd('python3 '.dirname(__FILE__).'/../get_privkey_password.py "'.$_POST['identifier'].'" "'.$_POST['password'].'" "'.$_POST['passphrase'].'"');
$privkey = shell_exec($privkey_shell);
$exec_string = escapeshellcmd(dirname(__FILE__)."/qrcode_generator.sh '".$timestamp."' '".trim($privkey)."'");
shell_exec($exec_string);
$attachment_location = '/tmp/fidelig1/qrcodes/'.$timestamp.'.qrcode.pdf';
if (file_exists($attachment_location)) {
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
header("Cache-Control: public"); // needed for internet explorer
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($attachment_location));
header("Content-Disposition: attachment; filename=".$timestamp.".qrcode.pdf");
readfile($attachment_location);
unlink($attachment_location);
}
die();
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Duniter private QRCode generator</title>
</head>
<body>
<div class="content">
<h1>Generate a private QRCode with passphrase</h1>
<form action="generate.php" method="POST">
<label for="password">Cesium wallet's identifier</label><br/>
<input type="password" name="identifier"><br/><br/>
<label for="password">Cesium wallet's password</label><br/>
<input type="password" name="password"><br/><br/>
<label for="passphrase">QRCode passphrase</label><br/>
<input type="password" name="passphrase"><br/><br/>
<input type="submit" value="Generate" name="submit">
</form>
</div>
</body>
</html>
\ No newline at end of file
#!/bin/bash
UNIQID="$1"
PRIVKEY="$2"
mkdir -p "/tmp/fidelig1/qrcodes"
qrencode -s 6 -o "/tmp/fidelig1/qrcodes/${UNIQID}-private.QR.png" "$PRIVKEY"
if ls /tmp/fidelig1/qrcodes/${UNIQID}-private.QR.png 1> /dev/null 2>&1
then
convert -density 150 /tmp/fidelig1/qrcodes/${UNIQID}-private.QR.png /tmp/fidelig1/qrcodes/${UNIQID}.qrcode.pdf
rm /tmp/fidelig1/qrcodes/${UNIQID}-private.QR.png
fi
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment