diff options
| author | Adam Soltys <[email protected]> | 2017-01-15 18:24:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2017-01-15 18:24:09 -0800 |
| commit | 7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e (patch) | |
| tree | 91bb1d1b8fe6ad77a48f0e429d9bfd35834c78d9 /public/js/generate_address.coffee | |
| parent | 0ae266bf88f9f79c7e99b272688126898303daa4 (diff) | |
| download | coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.tar.gz coinos-server-7762ceaa7e2bb34f8758e17a4c8f512fa6a81b9e.zip | |
Initial Vueification
Diffstat (limited to 'public/js/generate_address.coffee')
| -rw-r--r-- | public/js/generate_address.coffee | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/public/js/generate_address.coffee b/public/js/generate_address.coffee deleted file mode 100644 index face65ea..00000000 --- a/public/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) - - - |
