From c6230b95a46cc53ced0bbd8b7980757ec9938171 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Fri, 10 Jun 2016 21:39:58 +0200 Subject: [PATCH] Create simple demo ui --- config/default.js | 4 +++ src/route/hkp.js | 1 + src/route/home.js | 69 +++++++++++++++++++++++++++++++++++++++++------ src/route/rest.js | 2 ++ 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/config/default.js b/config/default.js index fb0c886..e6c733d 100644 --- a/config/default.js +++ b/config/default.js @@ -31,6 +31,10 @@ module.exports = { name: process.env.SENDER_NAME, email: process.env.SENDER_EMAIL } + }, + + ui: { + title: process.env.UI_TITLE || 'OpenPGP Public Key Server' } }; \ No newline at end of file diff --git a/src/route/hkp.js b/src/route/hkp.js index 29ffba1..78d11b0 100644 --- a/src/route/hkp.js +++ b/src/route/hkp.js @@ -46,6 +46,7 @@ class HKP { } let origin = util.origin(ctx); yield this._publicKey.put({ publicKeyArmored, origin }); + ctx.body = 'Upload successful. Check your inbox to verify your email address.'; ctx.status = 201; } diff --git a/src/route/home.js b/src/route/home.js index d8e56ec..abc45e9 100644 --- a/src/route/home.js +++ b/src/route/home.js @@ -1,32 +1,85 @@ 'use strict'; const util = require('../service/util'); +const config = require('config'); module.exports = function () { let hkpLink = util.hkpUrl(this); - let removeLink = util.url(util.origin(this), '/api/v1/removeKey?email=user@example.com'); this.body = ` - OpenPGP key server + ${config.ui.title} -

Welcome to the OpenPGP key server

-

This server verifies email address as well as private key ownership by sending an encrypted verification email.

+ +

${config.ui.title}

+

Try it out

    -
  1. Configure this key server in your HKP compatible OpenPGP client using this url: ${hkpLink}
  2. -
  3. Now just upload a public key like you always do.
  4. +
  5. Upload your public OpenPGP key using the form below.
  6. Check your inbox and click on the verification link inside the encrypted message.
  7. -
  8. You can delete all your data from the server at any time using this link: ${removeLink}
  9. +
  10. You can delete all your data from the server at any time using the form below.
  11. +
  12. Configure this key server in your HKP compatible OpenPGP client using this url: ${hkpLink}

Documentation and code

-

Please refer to the documentation to learn more about the api.

+

Please refer to the documentation to learn more about the REST api.

License AGPL v3.0

+
+ +

+ Find OpenPGP Key +

+
+

+ Get: + + Index: + +

+

+ Search: + +

+

+ + +

+
+
+ +

+ Upload a new OpenPGP Key +

+
+

Paste ASCII-armored OpenPGP key block here:

+

+ +

+

+ + +

+
+
+ +

+ Delete your OpenPGP Key +

+
+

+ Remove: + +

+

+ + +

+
+ `; diff --git a/src/route/rest.js b/src/route/rest.js index db14192..8cab93a 100644 --- a/src/route/rest.js +++ b/src/route/rest.js @@ -46,6 +46,7 @@ class REST { } let origin = util.origin(ctx); yield this._publicKey.put({ publicKeyArmored, primaryEmail, origin }); + ctx.body = 'Upload successful. Check your inbox to verify your email address.'; ctx.status = 201; } @@ -106,6 +107,7 @@ class REST { ctx.throw(400, 'Invalid request!'); } yield this._publicKey.requestRemove(q); + ctx.body = 'Check your inbox to verify the removal of your key.'; ctx.status = 202; }