Fully transition to PHP templating, improve key selection

This commit is contained in:
Yarmo Mackenbach 2020-07-02 02:36:15 +02:00
parent 82f6fee626
commit 7180086ef3
14 changed files with 382 additions and 615 deletions

View file

@ -98,13 +98,13 @@ async function verifySignature(opts) {
async function encryptMessage(opts) {
// Init
const elEnc = document.body.querySelector("#messageEncrypted");
const elEnc = document.body.querySelector("#message");
const elRes = document.body.querySelector("#result");
const elBtn = document.body.querySelector("[name='submit']");
let keyData, feedback, message, encrypted;
// Reset feedback
elRes.innerHTML = "";
elEnc.value = "";
try {
// Get key data
@ -130,6 +130,8 @@ async function encryptMessage(opts) {
// Display encrypted data
elEnc.value = encrypted.data;
elEnc.toggleAttribute("readonly");
elBtn.setAttribute("disabled", "true");
};
async function verifyProofs(opts) {
@ -151,6 +153,9 @@ async function verifyProofs(opts) {
return;
}
// Display feedback
elRes.innerHTML = "Verifying proofs…";
let notation, isVerified, verifications = [];
for (var i = 0; i < keyData.notations.length; i++) {
notation = keyData.notations[i];
@ -487,6 +492,15 @@ async function fetchKeys(opts) {
sigContent: null
};
// Autodetect mode
if (opts.mode == "auto") {
if (/.*@.*\..*/.test(opts.input)) {
opts.mode = "wkd";
} else {
opts.mode = "hkp";
}
}
// Fetch keys depending on the input mode
switch (opts.mode) {
case "plaintext":
@ -598,8 +612,20 @@ let elFormVerify = document.body.querySelector("#form-verify"),
elFormProofs = document.body.querySelector("#form-proofs"),
elProfileUid = document.body.querySelector("#profileUid"),
elProfileMode = document.body.querySelector("#profileMode"),
elModeSelect = document.body.querySelector("#modeSelect"),
elUtilWKD = document.body.querySelector("#form-util-wkd");
if (elModeSelect) {
elModeSelect.onchange = function (evt) {
let elAllModes = document.body.querySelectorAll('.modes');
elAllModes.forEach(function(el) {
el.classList.remove('modes--visible');
});
document.body.querySelector(`.modes--${elModeSelect.value}`).classList.add('modes--visible');
}
elModeSelect.dispatchEvent(new Event("change"));
}
if (elFormVerify) {
elFormVerify.onsubmit = function (evt) {
evt.preventDefault();
@ -612,20 +638,33 @@ if (elFormVerify) {
};
opts.signature = document.body.querySelector("#signature").value;
opts.mode = document.body.querySelector("#modeSelect").value;
if (document.body.querySelector("#publicKey").value != "") {
opts.input = document.body.querySelector("#publicKey").value;
opts.mode = "plaintext";
} else if (document.body.querySelector("#wkd").value != "") {
opts.input = document.body.querySelector("#wkd").value;
opts.mode = "wkd";
} else if (document.body.querySelector("#hkp_input").value != "") {
switch (opts.mode) {
default:
case "auto":
opts.input = document.body.querySelector("#auto_input").value;
break;
case "wkd":
opts.input = document.body.querySelector("#wkd_input").value;
break;
case "hkp":
opts.input = document.body.querySelector("#hkp_input").value;
opts.server = document.body.querySelector("#hkp_server").value;
opts.mode = "hkp";
} else {
break;
case "plaintext":
opts.input = document.body.querySelector("#plaintext_input").value;
break;
}
// If no input was detect
if (!opts.input) {
opts.mode = "signature";
}
verifySignature(opts);
};
}
@ -642,20 +681,28 @@ if (elFormEncrypt) {
};
opts.message = document.body.querySelector("#message").value;
opts.mode = document.body.querySelector("#modeSelect").value;
if (document.body.querySelector("#publicKey").value != "") {
opts.input = document.body.querySelector("#publicKey").value;
opts.mode = "plaintext";
} else if (document.body.querySelector("#wkd").value != "") {
opts.input = document.body.querySelector("#wkd").value;
opts.mode = "wkd";
} else if (document.body.querySelector("#hkp_input").value != "") {
switch (opts.mode) {
default:
case "auto":
opts.input = document.body.querySelector("#auto_input").value;
break;
case "wkd":
opts.input = document.body.querySelector("#wkd_input").value;
break;
case "hkp":
opts.input = document.body.querySelector("#hkp_input").value;
opts.server = document.body.querySelector("#hkp_server").value;
opts.mode = "hkp";
} else {
opts.mode = "signature";
break;
case "plaintext":
opts.input = document.body.querySelector("#plaintext_input").value;
break;
}
encryptMessage(opts);
};
}
@ -670,19 +717,28 @@ if (elFormProofs) {
server: null,
};
if (document.body.querySelector("#publicKey").value != "") {
opts.input = document.body.querySelector("#publicKey").value;
opts.mode = "plaintext";
} else if (document.body.querySelector("#wkd").value != "") {
opts.input = document.body.querySelector("#wkd").value;
opts.mode = "wkd";
} else if (document.body.querySelector("#hkp_input").value != "") {
opts.mode = document.body.querySelector("#modeSelect").value;
switch (opts.mode) {
default:
case "auto":
opts.input = document.body.querySelector("#auto_input").value;
break;
case "wkd":
opts.input = document.body.querySelector("#wkd_input").value;
break;
case "hkp":
opts.input = document.body.querySelector("#hkp_input").value;
opts.server = document.body.querySelector("#hkp_server").value;
opts.mode = "hkp";
} else {
opts.mode = null;
break;
case "plaintext":
opts.input = document.body.querySelector("#plaintext_input").value;
break;
}
verifyProofs(opts);
};
}

View file

@ -96,6 +96,11 @@ input[type="radio"] {
input[type="submit"] {
width: 100%;
}
input[type="submit"][disabled="true"] {
cursor: default;
pointer-events: none;
opacity: 0.3;
}
.green {
color: green;
}
@ -106,6 +111,15 @@ input[type="submit"] {
display: inline-block;
margin: 0 0 8px;
}
.modesContainer {
margin-top: 16px;
}
.modes {
display: none;
}
.modes.modes--visible {
display: block;
}
.container--profile {
margin-top: 64px;

126
index.php
View file

@ -7,10 +7,14 @@ include_once 'server/functions.php';
// Init router
$router = new AltoRouter();
// Init templating
$templates = new League\Plates\Engine('views');
// Router mapping
$router->map('GET', '/', function() {}, 'index');
$router->map('GET', '/guides', function() {}, 'guides');
$router->map('GET', '/guides/[:id]', function() {}, 'guideId');
$router->map('GET', '/util/[:id]', function() {}, 'util');
$router->map('GET', '/faq', function() {}, 'faq');
$router->map('GET', '/verify', function() {}, 'verify');
$router->map('GET', '/encrypt', function() {}, 'encrypt');
@ -21,12 +25,11 @@ $router->map('GET', '/proofs/hkp/[**:uid]', function() {}, 'proofsHKP');
$router->map('GET', '/verify/wkd/[**:uid]', function() {}, 'verifyWKD');
$router->map('GET', '/encrypt/wkd/[**:uid]', function() {}, 'encryptWKD');
$router->map('GET', '/proofs/wkd/[**:uid]', function() {}, 'proofsWKD');
$router->map('GET', '/verify/[:uid]', function() {}, 'verifyUid');
$router->map('GET', '/encrypt/[:uid]', function() {}, 'encryptUid');
$router->map('GET', '/proofs/[:uid]', function() {}, 'proofsUid');
$router->map('GET', '/verify/[**:uid]', function() {}, 'verifyAUTO');
$router->map('GET', '/encrypt/[**:uid]', function() {}, 'encryptAUTO');
$router->map('GET', '/proofs/[**:uid]', function() {}, 'proofsAUTO');
$router->map('GET', '/hkp/[**:uid]', function() {}, 'profileHKP');
$router->map('GET', '/wkd/[**:uid]', function() {}, 'profileWKD');
$router->map('GET', '/util/[:id]', function() {}, 'util');
$router->map('GET', '/[**:uid]', function() {}, 'profile');
// Router matching
@ -36,129 +39,94 @@ $match = $router->match();
if(is_array($match) && is_callable($match['target'])) {
switch ($match['name']) {
case 'index':
readfile('pages/index.html');
echo $templates->render('index');
break;
case 'verify':
case 'verifyUid':
echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'auto']);
break;
case 'verifyAUTO':
echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'auto', 'auto_input' => $match['params']['uid']]);
break;
case 'verifyHKP':
$content = file_get_contents('pages/verify.html');
$content = str_replace('%HKP_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
$content = str_replace('%WKD_UID%', '', $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
break;
case 'verifyWKD':
$content = file_get_contents('pages/verify.html');
$content = str_replace('%HKP_UID%', '', $content);
$content = str_replace('%WKD_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
break;
case 'encrypt':
case 'encryptUid':
echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'auto']);
break;
case 'encryptAUTO':
echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'auto', 'auto_input' => $match['params']['uid']]);
break;
case 'encryptHKP':
$content = file_get_contents('pages/encrypt.html');
$content = str_replace('%HKP_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
$content = str_replace('%WKD_UID%', '', $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
break;
case 'encryptWKD':
$content = file_get_contents('pages/encrypt.html');
$content = str_replace('%HKP_UID%', '', $content);
$content = str_replace('%WKD_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
break;
case 'proofs':
case 'proofsUid':
echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'auto']);
break;
case 'proofsAUTO':
echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'auto', 'auto_input' => $match['params']['uid']]);
break;
case 'proofsHKP':
$content = file_get_contents('pages/proofs.html');
$content = str_replace('%HKP_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
$content = str_replace('%WKD_UID%', '', $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
break;
case 'proofsWKD':
$content = file_get_contents('pages/proofs.html');
$content = str_replace('%HKP_UID%', '', $content);
$content = str_replace('%WKD_UID%', (array_key_exists('uid', $match['params']) ? htmlspecialchars($match['params']['uid']) : ''), $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
break;
case 'profile':
$content = file_get_contents('pages/profile.html');
$content = str_replace('%UID%', htmlspecialchars($match['params']['uid']), $content);
$content = str_replace('%MODE%', "auto", $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('profile', ['mode' => 'auto', 'uid' => htmlspecialchars($match['params']['uid'])]);
break;
case 'profileHKP':
$content = file_get_contents('pages/profile.html');
$content = str_replace('%UID%', htmlspecialchars($match['params']['uid']), $content);
$content = str_replace('%MODE%', "hkp", $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('profile', ['mode' => 'hkp', 'uid' => htmlspecialchars($match['params']['uid'])]);
break;
case 'profileWKD':
$content = file_get_contents('pages/profile.html');
$content = str_replace('%UID%', htmlspecialchars($match['params']['uid']), $content);
$content = str_replace('%MODE%', "wkd", $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render('profile', ['mode' => 'wkd', 'uid' => htmlspecialchars($match['params']['uid'])]);
break;
case 'guides':
readfile('pages/guides.html');
echo $templates->render('guides');
break;
case 'guideId':
$id = htmlspecialchars($match['params']['id']);
if (file_exists("pages/guides/$id.title.html")) {
$content = file_get_contents("pages/template.html");
$guideTitle = file_get_contents("pages/guides/$id.title.html");
$guideContent = file_get_contents("pages/guides/$id.content.html");
$guideContent = "<p><a href='/guides'>Back to guides</a></p>".$guideContent;
$content = str_replace('%TITLE%', $guideTitle, $content);
$content = str_replace('%CONTENT%', $guideContent, $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
if (file_exists("views/guides/$id.title.php")) {
$guideTitle = file_get_contents("views/guides/$id.title.php");
$guideContent = file_get_contents("views/guides/$id.content.php");
echo $templates->render('guide', ['guide_title' => $guideTitle, 'guide_content' => $guideContent]);
} else {
$content = file_get_contents("pages/template.html");
$pageTitle = "Guide not found";
$pageContent = "<p>404 - This guide could not be found :(</p>";
$content = str_replace('%TITLE%', $pageTitle, $content);
$content = str_replace('%CONTENT%', $pageContent, $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render("404");
}
break;
case 'util':
$id = htmlspecialchars($match['params']['id']);
readfile("pages/util/$id.html");
echo $templates->render("util/$id");
break;
case 'faq':
readfile("pages/faq.html");
echo $templates->render("faq");
break;
}
} else {
// No route was matched
$content = file_get_contents("pages/template.html");
$pageTitle = "404";
$pageContent = "<p>404 - This page could not be found :(</p>";
$content = str_replace('%TITLE%', $pageTitle, $content);
$content = str_replace('%CONTENT%', $pageContent, $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
echo $templates->render("404");
}

View file

@ -1,43 +1,6 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>%TITLE% - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>%TITLE%</h1>
<h1>404</h1>
<div class="content">
%CONTENT%
<p>The requested page could not be found :(</p>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
</html>

View file

@ -1,74 +1,34 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>Encrypt - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>Encrypt</h1>
<div class="content">
<form id="form-encrypt" method="post">
<h3>Recipient</h3>
<label for="mode">Mode: </label>
<select class="mode" name="mode" id="mode">
<option value="auto" %MODE_AUTO%>Autodetect</option>
<option value="wkd" %MODE_WKD%>Web Key Directory</option>
<option value="hkp" %MODE_HKP%>Keyservers</option>
<option value="plaintext" %MODE_PT%>Plaintext</option>
<label for="modeSelect">Mode: </label>
<select class="modeSelect" name="modeSelect" id="modeSelect">
<option value="auto" <?php if ($mode=="auto"): ?>selected<?php endif ?>>Autodetect</option>
<option value="wkd" <?php if ($mode=="wkd"): ?>selected<?php endif ?>>Web Key Directory</option>
<option value="hkp" <?php if ($mode=="hkp"): ?>selected<?php endif ?>>Keyserver</option>
<option value="plaintext" <?php if ($mode=="plaintext"): ?>selected<?php endif ?>>Plaintext</option>
</select>
<div class="modes modes--auto modes--hkp" style="display: none">
<input type="text" name="wkd" id="wkd" placeholder="Email / key id / fingerprint" value="%WKDUID%">
<div class="modesContainer">
<div class='modes modes--auto <?php if ($mode=="auto"): ?>modes--visible<?php endif ?>'>
<input type="text" name="auto_input" id="auto_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($auto_input)?>">
</div>
<div class='modes modes--wkd <?php if ($mode=="wkd"): ?>modes--visible<?php endif ?>'>
<input type="text" name="wkd_input" id="wkd_input" placeholder="name@domain.org" value="<?=$this->escape($wkd_input)?>">
</div>
<div class='modes modes--hkp <?php if ($mode=="hkp"): ?>modes--visible<?php endif ?>'>
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($hkp_input)?>">
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/ (default)">
</div>
<div class='modes modes--plaintext <?php if ($mode=="plaintext"): ?>modes--visible<?php endif ?>'>
<textarea name="plaintext_input" id="plaintext_input"></textarea>
</div>
<div class="modes modes--auto modes--hkp" style="display: none">
<input type="text" name="wkd" id="wkd" placeholder="Email / key id / fingerprint" value="%WKDUID%">
</div>
<h3>Message</h3>
<textarea name="message" id="message"></textarea>
<!-- <h3>Public Key (1: plaintext)</h3>
<textarea name="publicKey" id="publicKey"></textarea>
<h3>Public Key (2: web key directory)</h3>
<input type="text" name="wkd" id="wkd" placeholder="name@domain.com" value="%WKD_UID%">
<h3>Public Key (3: HKP server)</h3>
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/">
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="%HKP_UID%"> -->
<!-- <h3>Result</h3>
<textarea name="messageEncrypted" id="messageEncrypted" readonly></textarea> -->
<p id="result"></p>
<input type="submit" class="bigBtn" name="submit" value="ENCRYPT MESSAGE">
</form>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
<script src="/assets/openpgp.min.js"></script>
<script type="text/javascript" src="/assets/scripts.js" charset="utf-8"></script>
</html>

View file

@ -1,26 +1,5 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>FAQ - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>FAQ</h1>
<div class="content">
<h3 id="what-is-keyoxide"><a href="#what-is-keyoxide">#</a> What is Keyoxide?</h3>
@ -82,19 +61,3 @@
<li>Integrate other encryption programs</li>
</ul>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
</html>

7
views/guide.php Normal file
View file

@ -0,0 +1,7 @@
<?php $this->layout('template.base', ['title' => $title]) ?>
<h1><?=$this->escape($guide_title)?></h1>
<div class="content">
<p><a href='/guides'>Back to guides</a></p>
<?=$guide_content?>
</div>

View file

@ -1,26 +1,5 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>Guides - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>Guides</h1>
<div class="content">
<h3>Using Keyoxide.org</h3>
@ -47,19 +26,3 @@
<a href="/guides/github">Adding a Github proof</a><br>
<a href="/guides/xmpp">Adding a XMPP proof</a><br>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
</html>

View file

@ -1,26 +1,5 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>Keyoxide</h1>
<div class="content">
<h2>PGP actions</h2>
@ -48,19 +27,3 @@
Uses <a href="https://github.com/openpgpjs/openpgpjs">openpgp.js</a> (version <a href="https://github.com/openpgpjs/openpgpjs/releases/tag/v4.10.4">4.10.4</a>).
</p>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
</html>

View file

@ -9,10 +9,9 @@
</head>
<body>
<div class="container container--profile">
<!-- <h1 id="profileName"></h1> -->
<div class="content">
<span id="profileUid" style="display: none;">%UID%</span>
<span id="profileMode" style="display: none;">%MODE%</span>
<span id="profileUid" style="display: none;"><?=$this->escape($uid)?></span>
<span id="profileMode" style="display: none;"><?=$this->escape($mode)?></span>
<div id="profileHeader">
<img id="profileAvatar" src="/assets/img/avatar_placeholder.png" alt="avatar" style="display: none">
<p id="profileName"></p>
@ -21,9 +20,7 @@
</div>
<footer>
<p>
Page generated by <a href="/">Keyoxide</a>.
</p>
<p>Page generated by <a href="/">Keyoxide</a>.</p>
</footer>
</div>
</body>

View file

@ -1,58 +1,34 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>Profile - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>Proofs</h1>
<div class="content">
<form id="form-proofs" method="post">
<h3>Public Key (1: plaintext)</h3>
<textarea name="publicKey" id="publicKey"></textarea>
<h3>Public Key (2: web key directory)</h3>
<input type="text" name="wkd" id="wkd" placeholder="name@domain.com" value="%WKD_UID%">
<h3>Public Key (3: HKP server)</h3>
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/">
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="%HKP_UID%">
<h3>Public key</h3>
<label for="modeSelect">Mode: </label>
<select class="modeSelect" name="modeSelect" id="modeSelect">
<option value="auto" <?php if ($mode=="auto"): ?>selected<?php endif ?>>Autodetect</option>
<option value="wkd" <?php if ($mode=="wkd"): ?>selected<?php endif ?>>Web Key Directory</option>
<option value="hkp" <?php if ($mode=="hkp"): ?>selected<?php endif ?>>Keyserver</option>
<option value="plaintext" <?php if ($mode=="plaintext"): ?>selected<?php endif ?>>Plaintext</option>
</select>
<div class="modesContainer">
<div class='modes modes--auto <?php if ($mode=="auto"): ?>modes--visible<?php endif ?>'>
<input type="text" name="auto_input" id="auto_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($auto_input)?>">
</div>
<div class='modes modes--wkd <?php if ($mode=="wkd"): ?>modes--visible<?php endif ?>'>
<input type="text" name="wkd_input" id="wkd_input" placeholder="name@domain.org" value="<?=$this->escape($wkd_input)?>">
</div>
<div class='modes modes--hkp <?php if ($mode=="hkp"): ?>modes--visible<?php endif ?>'>
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($hkp_input)?>">
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/ (default)">
</div>
<div class='modes modes--plaintext <?php if ($mode=="plaintext"): ?>modes--visible<?php endif ?>'>
<textarea name="plaintext_input" id="plaintext_input"></textarea>
</div>
</div>
<h3>Result</h3>
<p id="result">Click on the button below.</p>
<p id="result"></p>
<p id="resultContent"></p>
<input type="submit" class="bigBtn" name="submit" value="VERIFY PROOFS">
</form>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
<script src="/assets/openpgp.min.js"></script>
<script type="text/javascript" src="/assets/scripts.js" charset="utf-8"></script>
</html>

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>%TITLE% - Keyoxide</title>
<title><?=$this->e($title)?>Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
@ -21,10 +21,7 @@
</header>
<div class="container">
<h1>%TITLE%</h1>
<div class="content">
%CONTENT%
</div>
<?=$this->section('content')?>
<footer>
<p>
@ -40,4 +37,7 @@
</div>
</body>
<script src="/assets/openpgp.min.js"></script>
<script src="/assets/spark-md5.min.js"></script>
<script type="text/javascript" src="/assets/scripts.js" charset="utf-8"></script>
</html>

View file

@ -1,26 +1,5 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>WKD utilities - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>WKD Local Part</h1>
<div class="content">
<form id="form-util-wkd" method="post">
@ -31,21 +10,3 @@
<input type="text" name="output" id="output" placeholder="Waiting for input..." readonly>
</form>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
<script type="text/javascript" src="/assets/scripts.js" charset="utf-8"></script>
</html>

View file

@ -1,60 +1,36 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png">
<title>Verify - Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body>
<header>
<div class="container">
<a href="/">Keyoxide</a>
<div class="spacer"></div>
<nav>
<a href="/verify">verify</a>
<a href="/encrypt">encrypt</a>
<a href="/proofs">proofs</a>
</nav>
</div>
</header>
<?php $this->layout('template.base', ['title' => $title]) ?>
<div class="container">
<h1>Verify</h1>
<div class="content">
<form id="form-verify" method="post">
<h3>Signer</h3>
<label for="modeSelect">Mode: </label>
<select class="modeSelect" name="modeSelect" id="modeSelect">
<option value="auto" <?php if ($mode=="auto"): ?>selected<?php endif ?>>Autodetect</option>
<option value="wkd" <?php if ($mode=="wkd"): ?>selected<?php endif ?>>Web Key Directory</option>
<option value="hkp" <?php if ($mode=="hkp"): ?>selected<?php endif ?>>Keyserver</option>
<option value="plaintext" <?php if ($mode=="plaintext"): ?>selected<?php endif ?>>Plaintext</option>
</select>
<div class="modesContainer">
<div class='modes modes--auto <?php if ($mode=="auto"): ?>modes--visible<?php endif ?>'>
<input type="text" name="auto_input" id="auto_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($auto_input)?>">
</div>
<div class='modes modes--wkd <?php if ($mode=="wkd"): ?>modes--visible<?php endif ?>'>
<input type="text" name="wkd_input" id="wkd_input" placeholder="name@domain.org" value="<?=$this->escape($wkd_input)?>">
</div>
<div class='modes modes--hkp <?php if ($mode=="hkp"): ?>modes--visible<?php endif ?>'>
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="<?=$this->escape($hkp_input)?>">
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/ (default)">
</div>
<div class='modes modes--plaintext <?php if ($mode=="plaintext"): ?>modes--visible<?php endif ?>'>
<textarea name="plaintext_input" id="plaintext_input"></textarea>
</div>
</div>
<h3>Signature</h3>
<textarea name="signature" id="signature"></textarea>
<h3>Public Key (1: plaintext)</h3>
<textarea name="publicKey" id="publicKey"></textarea>
<h3>Public Key (2: web key directory)</h3>
<input type="text" name="wkd" id="wkd" placeholder="name@domain.com" value="%WKD_UID%">
<h3>Public Key (3: HKP server)</h3>
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/">
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="%HKP_UID%">
<h3>Result</h3>
<p id="result">Click on the button below.</p>
<p id="result"></p>
<p id="resultContent"></p>
<input type="submit" class="bigBtn" name="submit" value="VERIFY SIGNATURE">
</form>
</div>
<footer>
<p>
Sitemap:
<a href="/">index</a> -
<a href="/encrypt">encrypt</a> -
<a href="/verify">verify</a> -
<a href="/proofs">proofs</a> -
<a href="/guides">guides</a> -
<a href="/faq">faq</a>
</p>
</footer>
</div>
</body>
<script src="/assets/openpgp.min.js"></script>
<script type="text/javascript" src="/assets/scripts.js" charset="utf-8"></script>
</html>