aboutsummaryrefslogtreecommitdiffstats
path: root/static/js/generate_address.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2017-01-21 18:56:05 -0800
committerAdam Soltys <[email protected]>2017-01-21 18:56:05 -0800
commitc413e457579b68b7a92ab47cdd867202ee7bb47e (patch)
tree4d84c4af06e936a54890468cc4351deabcd8c0f9 /static/js/generate_address.coffee
parent931f2262d9ef7f571fe87b176f6cd531b3579a68 (diff)
downloadcoinos-server-c413e457579b68b7a92ab47cdd867202ee7bb47e.tar.gz
coinos-server-c413e457579b68b7a92ab47cdd867202ee7bb47e.zip
Ditch coffeescript
Diffstat (limited to 'static/js/generate_address.coffee')
-rw-r--r--static/js/generate_address.coffee74
1 files changed, 0 insertions, 74 deletions
diff --git a/static/js/generate_address.coffee b/static/js/generate_address.coffee
deleted file mode 100644
index face65ea..00000000
--- a/static/js/generate_address.coffee
+++ /dev/null
@@ -1,74 +0,0 @@
-g = this
-
-$(->
- genKey()
- $('.regenerate').click(genKey)
-
- $('#encrypt').submit(->
- $('.form-control').blur()
- if $('.has-error').length > 0
- $('.has-error').effect('shake', 500)
- return false
-
- $('#modal').modal()
- return false
- )
-
- $('#modal').on('shown.bs.modal', ->
- bip38 = new Bip38
- g.enc_privkey = bip38.encrypt(g.privkey, $('#password').val(), g.pubkey)
- $('#modal-body').html('Done!')
- setTimeout(
- -> $('#modal').modal('hide')
- 1000
- )
- )
-
- $('#modal').on('hidden.bs.modal', ->
- if $('#password').val() == ''
- g.enc_privkey = g.privkey
- $('#status').html('')
- else
- $('#status').html('Encrypted')
-
- $('#privkey').html(g.enc_privkey)
- $('#privqr').html('')
- new QRCode('privqr', text: $('#privkey').html(), width: 260, height: 260)
- )
-
- $('.print').click(-> window.print())
- $('#password').pwstrength(showVerdicts: false)
- $('#password').blur(->
- $('#confirm').blur()
- $(this).parent().next('.alert').remove()
-
- if $('.progress-bar-success').length > 0
- $(this).parent().removeClass('has-error')
- else
- $(this).parent().addClass('has-error')
- )
- $('#confirm').blur(->
- if $('#password').val() == $('#confirm').val()
- $('#confirm').parent().removeClass('has-error')
- else
- $('#confirm').parent().addClass('has-error')
- )
-)
-
-genKey = ->
- $('#password').focus()
- key = bitcoin.ECKey.makeRandom(false)
- g.privkey = key.toWIF()
- g.pubkey = key.pub.getAddress().toString()
-
- $('#pubkey').html(g.pubkey)
- $('#privkey').html(g.privkey)
-
- $('#pubqr, #privqr, #status').html('')
- $('#password, #confirm').val('').keyup().parent().removeClass('has-error')
-
- new QRCode('pubqr', text: $('#pubkey').html(), width: 260, height: 260)
- new QRCode('privqr', text: $('#privkey').html(), width: 260, height: 260)
-
-
-