From d1350773720b709e549927a2bf23548aab8df14a Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Sat, 6 Apr 2019 12:38:35 -0500 Subject: make it possible to import your existing keypair --- app.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 02c7be1..66816c5 100644 --- a/app.js +++ b/app.js @@ -56,16 +56,29 @@ function route () { if (src === 'key') { var keyMessage = h('div', {classList: 'message'}) + keyMessage.appendChild(h('p', {innerHTML: marked('This is your ed25519 public/private keypair. It was generated using [Tweetnacl.js](https://tweetnacl.js.org/#/). Your public key is your identiy when using [Bogbook](http://bogbook.com/), save your key in a safe place so that you can continue to use the same identity.')})) + + // print stringified keypair + keyMessage.appendChild(h('pre', {style: 'width: 80%'}, [h('code', [JSON.stringify(keys)])])) + // delete key button - keyMessage.appendChild(h('button', {classList: 'right', + keyMessage.appendChild(h('button', { onclick: function () { localStorage['id'] = '' location.reload() } }, ['Delete Key'])) - - // print stringified keypair - keyMessage.appendChild(h('pre', {style: 'width: 80%'}, [h('code', [JSON.stringify(keys)])])) + + var textarea = h('textarea', {placeholder: 'Import your existing ed25519 keypair'}) + keyMessage.appendChild(textarea) + keyMessage.appendChild(h('button', { + onclick: function () { + if (textarea.value) { + localStorage['id'] = textarea.value + location.reload() + } + } + }, ['Import Key'])) scroller.appendChild(keyMessage) } -- cgit v1.2.3-70-g09d2