示例#1
0
function processKey(p, type) {
 $('#' + type + '_key').text(p["pubKeys"][type]);
 $('#' + type + '_pkey').text(p["privKeys"][type].toWif());
 qrcodedraw.draw(document.getElementById(type + "_pub"), p["pubKeys"][type], function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById(type + "_wif"), p["privKeys"][type].toWif(), function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
}
示例#2
0
$('input[name=password]').keypress(function() {
 var name = $('input[name=name]').val();
 var passwod = $('input[name=password]').val();
 if (!verifyPasswordLength(passwod) || !name) {
  return;
 }
 $result.hide();
 var p = Login.generateKeys(name, passwod, ["owner", "active", "posting", "memo"], prefix);
 $('#owner_key').text(p["pubKeys"]["owner"]);
 $('#active_key').text(p["pubKeys"]["active"]);
 $('#posting_key').text(p["pubKeys"]["posting"]);
 $('#memo_key').text(p["pubKeys"]["memo"]);
 qrcodedraw.draw(document.getElementById("owner_pub"), p["pubKeys"]["owner"], function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("active_pub"), p["pubKeys"]["active"], function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("posting_pub"), p["pubKeys"]["posting"], function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("memo_pub"), p["pubKeys"]["memo"], function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });

 $('#owner_pkey').text(p["privKeys"]["owner"].toWif());
 $('#active_pkey').text(p["privKeys"]["active"].toWif());
 $('#posting_pkey').text(p["privKeys"]["posting"].toWif());
 $('#memo_pkey').text(p["privKeys"]["memo"].toWif());
 qrcodedraw.draw(document.getElementById("owner_wif"), p["privKeys"]["owner"].toWif(), function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("active_wif"), p["privKeys"]["active"].toWif(), function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("posting_wif"), p["privKeys"]["posting"].toWif(), function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });
 qrcodedraw.draw(document.getElementById("memo_wif"), p["privKeys"]["memo"].toWif(), function(error,canvas){
   if(error){ return console.log('Error =( ', error); }
 });

 $result.show();
});
示例#3
0
'use strict';

require('file?name=[name].[ext]!./public/index.html');
require("bootstrap-webpack");

require("./public/img/coldstorage-importkey.png");
require("./public/img/update-account.png");

import {Address, Aes, PrivateKey, PublicKey, Signature, key} from "@graphene/ecc"
import QRCode from 'qrcode';

let qrcodedraw = new QRCode.QRCodeDraw();

let priv = key.get_random_key()
let wif = priv.toWif()
let pub = priv.toPublicKey().toPublicKeyString()

$("#wiftext").text(wif);
$("#pubtext").text(pub);

qrcodedraw.draw(document.getElementById("wif"), wif, function(error,canvas){
  if(error){
     return console.log('Error =( ',error);
  }
  console.log('WIF QR code generated');
});

qrcodedraw.draw(document.getElementById("pub"), pub, function(error,canvas){
  if(error){
     return console.log('Error =( ',error);
  }