~ev/tildeprotocol

566e0e857e8748c90da35bdbec6602ebd7fd2d07 — Ev Bogue 4 years ago 2a9d818
add key import/export
1 files changed, 28 insertions(+), 0 deletions(-)

M app.js
M app.js => app.js +28 -0
@@ 15,6 15,34 @@ function route (keys) {
      scroller.appendChild(render(msg))
    })
  }

  if (src === 'key') {
    var keyDiv = h('div', {classList: 'message'})

    keyDiv.appendChild(h('pre', {style: 'width: 80%'}, [h('code', [keys])]))

    keyDiv.appendChild(h('button', {
      onclick: function () {
       localforage.removeItem('id', function () {
         location.hash = ''
         location.reload()
       })
      }
    }, ['Delete Key']))

    var textarea = h('textarea', {placeholder: 'Import your existing ed25519 keypair (right now this only supports ~protocol keys'})

    keyDiv.appendChild(textarea)

    keyDiv.appendChild(h('button', {
      onclick: function () {
        if (textarea.value) {
          localforage.setItem('id', textarea.value).then(function () { location.reload() })
        }
      }
    }, ['Import Key']))
    scroller.appendChild(keyDiv)
  }
}

window.onhashchange = function () {