git ssb

0+

ev / minbase



Tree: 3ee0398629a78832c2fbe78831ce756faeaeca74

Files: 3ee0398629a78832c2fbe78831ce756faeaeca74 / modules / key.js

1933 bytesRaw
1var h = require('hyperscript')
2var u = require('../util')
3var pull = require('pull-stream')
4var Scroller = require('pull-scroll')
5
6var config = require('../config')()
7
8exports.gives = {
9 screen_view: true
10}
11
12exports.create = function (api) {
13 return {
14 screen_view: function (path, sbot) {
15 if(path === 'Key') {
16 var importKey = h('textarea.import', {placeholder: 'Import a new public/private key', name: 'textarea', style: 'width: 97%; height: 100px;'})
17 var content = h('div.column.scroller__content')
18 var div = h('div.column.scroller',
19 {style: {'overflow':'auto'}},
20 h('div.scroller__wrapper',
21 h('div.column.scroller__content',
22 h('div.message',
23 h('h1', 'Your Key'),
24 h('p', {innerHTML: 'Your public/private key is: <pre><code>' + localStorage[config.caps.shs + '/secret'] + '</code></pre>'},
25 h('button.btn.btn-danger', {onclick: function (e){
26 localStorage[config.caps.shs +'/secret'] = ''
27 alert('Your public/private key has been deleted')
28 e.preventDefault()
29 location.hash = ""
30 location.reload()
31 }}, 'Delete Key')
32 ),
33 h('hr'),
34 h('form',
35 importKey,
36 h('button.btn.btn-success', {onclick: function (e){
37 if(importKey.value) {
38 localStorage[config.caps.shs + '/secret'] = importKey.value.replace(/\s+/g, ' ')
39 e.preventDefault()
40 alert('Your public/private key has been updated')
41 }
42 location.hash = ""
43 location.reload()
44 }}, 'Import key'),
45 )
46 )
47 )
48 )
49 )
50 return div
51 }
52 }
53 }
54}
55
56

Built with git-ssb-web