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

View file

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

126
index.php
View file

@ -7,10 +7,14 @@ include_once 'server/functions.php';
// Init router // Init router
$router = new AltoRouter(); $router = new AltoRouter();
// Init templating
$templates = new League\Plates\Engine('views');
// Router mapping // Router mapping
$router->map('GET', '/', function() {}, 'index'); $router->map('GET', '/', function() {}, 'index');
$router->map('GET', '/guides', function() {}, 'guides'); $router->map('GET', '/guides', function() {}, 'guides');
$router->map('GET', '/guides/[:id]', function() {}, 'guideId'); $router->map('GET', '/guides/[:id]', function() {}, 'guideId');
$router->map('GET', '/util/[:id]', function() {}, 'util');
$router->map('GET', '/faq', function() {}, 'faq'); $router->map('GET', '/faq', function() {}, 'faq');
$router->map('GET', '/verify', function() {}, 'verify'); $router->map('GET', '/verify', function() {}, 'verify');
$router->map('GET', '/encrypt', function() {}, 'encrypt'); $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', '/verify/wkd/[**:uid]', function() {}, 'verifyWKD');
$router->map('GET', '/encrypt/wkd/[**:uid]', function() {}, 'encryptWKD'); $router->map('GET', '/encrypt/wkd/[**:uid]', function() {}, 'encryptWKD');
$router->map('GET', '/proofs/wkd/[**:uid]', function() {}, 'proofsWKD'); $router->map('GET', '/proofs/wkd/[**:uid]', function() {}, 'proofsWKD');
$router->map('GET', '/verify/[:uid]', function() {}, 'verifyUid'); $router->map('GET', '/verify/[**:uid]', function() {}, 'verifyAUTO');
$router->map('GET', '/encrypt/[:uid]', function() {}, 'encryptUid'); $router->map('GET', '/encrypt/[**:uid]', function() {}, 'encryptAUTO');
$router->map('GET', '/proofs/[:uid]', function() {}, 'proofsUid'); $router->map('GET', '/proofs/[**:uid]', function() {}, 'proofsAUTO');
$router->map('GET', '/hkp/[**:uid]', function() {}, 'profileHKP'); $router->map('GET', '/hkp/[**:uid]', function() {}, 'profileHKP');
$router->map('GET', '/wkd/[**:uid]', function() {}, 'profileWKD'); $router->map('GET', '/wkd/[**:uid]', function() {}, 'profileWKD');
$router->map('GET', '/util/[:id]', function() {}, 'util');
$router->map('GET', '/[**:uid]', function() {}, 'profile'); $router->map('GET', '/[**:uid]', function() {}, 'profile');
// Router matching // Router matching
@ -36,129 +39,94 @@ $match = $router->match();
if(is_array($match) && is_callable($match['target'])) { if(is_array($match) && is_callable($match['target'])) {
switch ($match['name']) { switch ($match['name']) {
case 'index': case 'index':
readfile('pages/index.html'); echo $templates->render('index');
break; break;
case 'verify': 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': case 'verifyHKP':
$content = file_get_contents('pages/verify.html'); echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
$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);
break; break;
case 'verifyWKD': case 'verifyWKD':
$content = file_get_contents('pages/verify.html'); echo $templates->render('verify', ['title' => 'Verify — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
$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);
break; break;
case 'encrypt': 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': case 'encryptHKP':
$content = file_get_contents('pages/encrypt.html'); echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
$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);
break; break;
case 'encryptWKD': case 'encryptWKD':
$content = file_get_contents('pages/encrypt.html'); echo $templates->render('encrypt', ['title' => 'Encrypt — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
$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);
break; break;
case 'proofs': 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': case 'proofsHKP':
$content = file_get_contents('pages/proofs.html'); echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'hkp', 'hkp_input' => $match['params']['uid']]);
$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);
break; break;
case 'proofsWKD': case 'proofsWKD':
$content = file_get_contents('pages/proofs.html'); echo $templates->render('proofs', ['title' => 'Proofs — ', 'mode' => 'wkd', 'wkd_input' => $match['params']['uid']]);
$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);
break; break;
case 'profile': case 'profile':
$content = file_get_contents('pages/profile.html'); echo $templates->render('profile', ['mode' => 'auto', 'uid' => htmlspecialchars($match['params']['uid'])]);
$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);
break; break;
case 'profileHKP': case 'profileHKP':
$content = file_get_contents('pages/profile.html'); echo $templates->render('profile', ['mode' => 'hkp', 'uid' => htmlspecialchars($match['params']['uid'])]);
$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);
break; break;
case 'profileWKD': case 'profileWKD':
$content = file_get_contents('pages/profile.html'); echo $templates->render('profile', ['mode' => 'wkd', 'uid' => htmlspecialchars($match['params']['uid'])]);
$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);
break; break;
case 'guides': case 'guides':
readfile('pages/guides.html'); echo $templates->render('guides');
break; break;
case 'guideId': case 'guideId':
$id = htmlspecialchars($match['params']['id']); $id = htmlspecialchars($match['params']['id']);
if (file_exists("pages/guides/$id.title.html")) { if (file_exists("views/guides/$id.title.php")) {
$content = file_get_contents("pages/template.html"); $guideTitle = file_get_contents("views/guides/$id.title.php");
$guideTitle = file_get_contents("pages/guides/$id.title.html"); $guideContent = file_get_contents("views/guides/$id.content.php");
$guideContent = file_get_contents("pages/guides/$id.content.html"); echo $templates->render('guide', ['guide_title' => $guideTitle, 'guide_content' => $guideContent]);
$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);
} else { } else {
$content = file_get_contents("pages/template.html"); echo $templates->render("404");
$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);
} }
break; break;
case 'util': case 'util':
$id = htmlspecialchars($match['params']['id']); $id = htmlspecialchars($match['params']['id']);
readfile("pages/util/$id.html"); echo $templates->render("util/$id");
break; break;
case 'faq': case 'faq':
readfile("pages/faq.html"); echo $templates->render("faq");
break; break;
} }
} else { } else {
// No route was matched // No route was matched
$content = file_get_contents("pages/template.html"); echo $templates->render("404");
$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);
} }

View file

@ -1,43 +1,6 @@
<!DOCTYPE html> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container"> <h1>404</h1>
<h1>%TITLE%</h1>
<div class="content"> <div class="content">
%CONTENT% <p>The requested page could not be found :(</p>
</div> </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> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>Encrypt</h1> <h1>Encrypt</h1>
<div class="content"> <div class="content">
<form id="form-encrypt" method="post"> <form id="form-encrypt" method="post">
<h3>Recipient</h3> <h3>Recipient</h3>
<label for="mode">Mode: </label> <label for="modeSelect">Mode: </label>
<select class="mode" name="mode" id="mode"> <select class="modeSelect" name="modeSelect" id="modeSelect">
<option value="auto" %MODE_AUTO%>Autodetect</option> <option value="auto" <?php if ($mode=="auto"): ?>selected<?php endif ?>>Autodetect</option>
<option value="wkd" %MODE_WKD%>Web Key Directory</option> <option value="wkd" <?php if ($mode=="wkd"): ?>selected<?php endif ?>>Web Key Directory</option>
<option value="hkp" %MODE_HKP%>Keyservers</option> <option value="hkp" <?php if ($mode=="hkp"): ?>selected<?php endif ?>>Keyserver</option>
<option value="plaintext" %MODE_PT%>Plaintext</option> <option value="plaintext" <?php if ($mode=="plaintext"): ?>selected<?php endif ?>>Plaintext</option>
</select> </select>
<div class="modes modes--auto modes--hkp" style="display: none"> <div class="modesContainer">
<input type="text" name="wkd" id="wkd" placeholder="Email / key id / fingerprint" value="%WKDUID%"> <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>
<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> </div>
<h3>Message</h3> <h3>Message</h3>
<textarea name="message" id="message"></textarea> <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> <p id="result"></p>
<input type="submit" class="bigBtn" name="submit" value="ENCRYPT MESSAGE"> <input type="submit" class="bigBtn" name="submit" value="ENCRYPT MESSAGE">
</form> </form>
</div> </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> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>FAQ</h1> <h1>FAQ</h1>
<div class="content"> <div class="content">
<h3 id="what-is-keyoxide"><a href="#what-is-keyoxide">#</a> What is Keyoxide?</h3> <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> <li>Integrate other encryption programs</li>
</ul> </ul>
</div> </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> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>Guides</h1> <h1>Guides</h1>
<div class="content"> <div class="content">
<h3>Using Keyoxide.org</h3> <h3>Using Keyoxide.org</h3>
@ -47,19 +26,3 @@
<a href="/guides/github">Adding a Github proof</a><br> <a href="/guides/github">Adding a Github proof</a><br>
<a href="/guides/xmpp">Adding a XMPP proof</a><br> <a href="/guides/xmpp">Adding a XMPP proof</a><br>
</div> </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> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>Keyoxide</h1> <h1>Keyoxide</h1>
<div class="content"> <div class="content">
<h2>PGP actions</h2> <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>). 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> </p>
</div> </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> </head>
<body> <body>
<div class="container container--profile"> <div class="container container--profile">
<!-- <h1 id="profileName"></h1> -->
<div class="content"> <div class="content">
<span id="profileUid" style="display: none;">%UID%</span> <span id="profileUid" style="display: none;"><?=$this->escape($uid)?></span>
<span id="profileMode" style="display: none;">%MODE%</span> <span id="profileMode" style="display: none;"><?=$this->escape($mode)?></span>
<div id="profileHeader"> <div id="profileHeader">
<img id="profileAvatar" src="/assets/img/avatar_placeholder.png" alt="avatar" style="display: none"> <img id="profileAvatar" src="/assets/img/avatar_placeholder.png" alt="avatar" style="display: none">
<p id="profileName"></p> <p id="profileName"></p>
@ -21,9 +20,7 @@
</div> </div>
<footer> <footer>
<p> <p>Page generated by <a href="/">Keyoxide</a>.</p>
Page generated by <a href="/">Keyoxide</a>.
</p>
</footer> </footer>
</div> </div>
</body> </body>

View file

@ -1,58 +1,34 @@
<!DOCTYPE html> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>Proofs</h1> <h1>Proofs</h1>
<div class="content"> <div class="content">
<form id="form-proofs" method="post"> <form id="form-proofs" method="post">
<h3>Public Key (1: plaintext)</h3> <h3>Public key</h3>
<textarea name="publicKey" id="publicKey"></textarea> <label for="modeSelect">Mode: </label>
<h3>Public Key (2: web key directory)</h3> <select class="modeSelect" name="modeSelect" id="modeSelect">
<input type="text" name="wkd" id="wkd" placeholder="name@domain.com" value="%WKD_UID%"> <option value="auto" <?php if ($mode=="auto"): ?>selected<?php endif ?>>Autodetect</option>
<h3>Public Key (3: HKP server)</h3> <option value="wkd" <?php if ($mode=="wkd"): ?>selected<?php endif ?>>Web Key Directory</option>
<input type="text" name="hkp_server" id="hkp_server" placeholder="https://keys.openpgp.org/"> <option value="hkp" <?php if ($mode=="hkp"): ?>selected<?php endif ?>>Keyserver</option>
<input type="text" name="hkp_input" id="hkp_input" placeholder="Email / key id / fingerprint" value="%HKP_UID%"> <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> <h3>Result</h3>
<p id="result">Click on the button below.</p> <p id="result"></p>
<p id="resultContent"></p> <p id="resultContent"></p>
<input type="submit" class="bigBtn" name="submit" value="VERIFY PROOFS"> <input type="submit" class="bigBtn" name="submit" value="VERIFY PROOFS">
</form> </form>
</div> </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 charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.png"> <link rel="shortcut icon" href="/favicon.png">
<title>%TITLE% - Keyoxide</title> <title><?=$this->e($title)?>Keyoxide</title>
<link rel="stylesheet" href="/assets/styles.css"> <link rel="stylesheet" href="/assets/styles.css">
</head> </head>
<body> <body>
@ -21,10 +21,7 @@
</header> </header>
<div class="container"> <div class="container">
<h1>%TITLE%</h1> <?=$this->section('content')?>
<div class="content">
%CONTENT%
</div>
<footer> <footer>
<p> <p>
@ -40,4 +37,7 @@
</div> </div>
</body> </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> </html>

View file

@ -1,26 +1,5 @@
<!DOCTYPE html> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>WKD Local Part</h1> <h1>WKD Local Part</h1>
<div class="content"> <div class="content">
<form id="form-util-wkd" method="post"> <form id="form-util-wkd" method="post">
@ -31,21 +10,3 @@
<input type="text" name="output" id="output" placeholder="Waiting for input..." readonly> <input type="text" name="output" id="output" placeholder="Waiting for input..." readonly>
</form> </form>
</div> </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> <?php $this->layout('template.base', ['title' => $title]) ?>
<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>
<div class="container">
<h1>Verify</h1> <h1>Verify</h1>
<div class="content"> <div class="content">
<form id="form-verify" method="post"> <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> <h3>Signature</h3>
<textarea name="signature" id="signature"></textarea> <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> <h3>Result</h3>
<p id="result">Click on the button below.</p> <p id="result"></p>
<p id="resultContent"></p> <p id="resultContent"></p>
<input type="submit" class="bigBtn" name="submit" value="VERIFY SIGNATURE"> <input type="submit" class="bigBtn" name="submit" value="VERIFY SIGNATURE">
</form> </form>
</div> </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>