diff options
author | Ev Bogue <ev@evbogue.com> | 2019-04-06 12:38:35 -0500 |
---|---|---|
committer | Ev Bogue <ev@evbogue.com> | 2019-04-06 12:38:35 -0500 |
commit | d1350773720b709e549927a2bf23548aab8df14a (patch) | |
tree | 16e337d0f5601130f76f496a393ccf3717e9667e | |
parent | 618a88e33b0bc49e7b914a9bd24c8838a8cd8f57 (diff) |
make it possible to import your existing keypair
-rw-r--r-- | app.js | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -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) } |