Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
snowypowers committed Mar 12, 2018
2 parents d46af7a + 4de0348 commit d967787
Show file tree
Hide file tree
Showing 14 changed files with 1,919 additions and 1,551 deletions.
4 changes: 2 additions & 2 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"main.css": "static/css/main.3216d0fc.css",
"main.js": "static/js/main.0ac0a6b8.js"
"main.css": "static/css/main.3c6711ba.css",
"main.js": "static/js/main.befad51e.js"
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="./manifest.json"><link rel="shortcut icon" href="./favicon.ico"><title>Ansy - Minimal NEO Paper Wallet</title><link href="./static/css/main.3216d0fc.css" rel="stylesheet"></head><body><a class="ribbon" href="https://github.com/snowypowers/ansy"><img style="position:absolute;top:0;right:0;border:0" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/main.0ac0a6b8.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/ansy/manifest.json"><link rel="shortcut icon" href="/ansy/favicon.ico"><title>Ansy - Minimal NEO Paper Wallet</title><link href="/ansy/static/css/main.3c6711ba.css" rel="stylesheet"></head><body><a class="ribbon" href="https://github.com/snowypowers/ansy"><img style="position:absolute;top:0;right:0;border:0" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/ansy/static/js/main.befad51e.js"></script></body></html>

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/static/js/main.0ac0a6b8.js

This file was deleted.

2 changes: 2 additions & 0 deletions docs/static/js/main.befad51e.js

Large diffs are not rendered by default.

25 changes: 9 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansy",
"version": "2.0.0",
"version": "2.0.1",
"main": "src/index.js",
"author": "Yak Jun Xiang <[email protected]>",
"license": "MIT",
Expand All @@ -11,26 +11,19 @@
"eject": "react-scripts eject",
"lint": "./node_modules/.bin/eslint ./src/*.js"
},
"homepage": ".",
"homepage": "https://snowypowers.github.io/ansy/",
"dependencies": {
"bigi": "^1.4.2",
"bs58": "^4.0.1",
"bs58check": "^2.0.2",
"crypto-js": "^3.1.9-1",
"ecurve": "^1.0.5",
"hash.js": "^1.1.3",
"hmac-drbg": "^1.0.1",
"@cityofzion/neon-js": "^3.4.0",
"picnic": "^6.4.0",
"prop-types": "^15.5.10",
"qrcode": "^0.8.2",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "^1.0.10",
"scryptsy": "^2.0.0"
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "^1.0.10"
},
"devDependencies": {
"eslint": "^3.19.0",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-react": "^7.1.0"
"eslint": "^4.18.2",
"eslint-plugin-jest": "^21.14.0",
"eslint-plugin-react": "^7.7.0"
}
}
2 changes: 1 addition & 1 deletion src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Footer extends Component {
render() {
return (
<div id="foot">
<p>Made by snowypowers | v2.0.0</p>
<p>Made by snowypowers | v2.0.1</p>
<p>Tips appreciated!</p>
<div>NEO: AbUKT3KXcAMpLD1MsAMRNhgN3hqmzEqqVP</div>
<div>ETH: 0x2E15cd6Ca9f8dcdCd08Ad62d901b6E6a815a36fd </div>
Expand Down
72 changes: 28 additions & 44 deletions src/components/Form.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import crypto from '../modules/crypto'
import NEP2 from '../modules/nep2'
import { wallet } from '@cityofzion/neon-js'

export default class Form extends Component {
constructor(props) {
Expand All @@ -14,85 +13,70 @@ export default class Form extends Component {
this.genWallet = this.genWallet.bind(this)
this.genKey = this.genKey.bind(this)
}
genWallet() {
genWallet () {
if (this.private.value === '') {
this.setState({ error: 'Empty Field!' })
return
}
if (this.private.value.length !== 64 && this.private.value.length !== 52 && this.private.value.length !== 58) {
if (!wallet.isNEP2(this.private.value) && !wallet.isWIF(this.private.value) && !wallet.isPrivateKey(this.private.value)) {
this.setState({ error: 'Wrong Private Key Length!' })
return
}

let privateKey = this.private.value
let verifyAddr
let newWallet = {
address: verifyAddr,
private: privateKey,
nep2: ''
}
// Decrypt NEP2
if (this.private.value.length === 58 && this.conPassword.value.length > 0) {
try {
newWallet.nep2 = this.private.value
privateKey = NEP2.decrypt(this.private.value, this.conPassword.value)
this.conPassword.value = ''
} catch(e) {
this.setState({error: 'Invalid Password'})
return
}
}

// Test Private key and get Address
let newWallet = {}
try {
if (this.private.value.length === 52) {
privateKey = crypto.getHexFromWif(this.private.value)
}
verifyAddr = crypto.getAddrFromPri(privateKey)
if (this.address.value !== '' && this.address.value !== verifyAddr) {
this.setState({ error: 'Address Verification Failed' })
return
const acct = new wallet.Account(this.private.value)
if (wallet.isNEP2(this.private.value)) {
if (this.conPassword.value.length > 0) {
newWallet.nep2 = acct.encrypted
acct.decrypt(this.conPassword.value)
} else {
this.setState({error: "Encrypted key provided without password!"})
}
}
newWallet.private = acct.privateKey
newWallet.public = acct.publicKey
newWallet.address = acct.address
} catch (e) {
this.setState({ error: "Invalid Private key!" })
return
}
newWallet.address = verifyAddr
newWallet.private = privateKey
if (this.conPassword.value.length > 0) {
newWallet.nep2 = NEP2.encrypt(newWallet.private, this.conPassword.value)
}

const done = this.props.addWallet(newWallet)
if (done) {
this.private.value = ''
this.address.value = ''
this.conPassword.value = ''
this.setState({ error: '' })
} else {
this.setState({ error: "Duplicate wallet!" })
}
}

genKey() {
const privateKey = crypto.genPriKey()
const address = crypto.getAddrFromPri(privateKey)
let newWallet = { address, private: privateKey, type:'Normal' }
genKey () {
const acct = new wallet.Account()
let newWallet = {
address: acct.address,
private: acct.privateKey,
type: 'Normal'
}
if (this.genPassword.value.length > 0) {
newWallet.nep2 = NEP2.encrypt(privateKey, this.genPassword.value)
newWallet.type='NEP2'
newWallet.nep2 = wallet.encrypt(newWallet.private, this.genPassword.value)
newWallet.type = 'NEP2'
}
const done = this.props.addWallet(newWallet)
if (!done) {
this.genKey()
}
}

errorHTML() {
errorHTML () {
return (
<p className="center-text" key="error"><span className="label error">{this.state.error}</span></p>
)
}

render() {
render () {
const formContainer = {
padding: 0,
margin: "0 auto"
Expand Down
15 changes: 8 additions & 7 deletions src/components/Wallet.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import QR from './QR.js'
import crypto from '../modules/crypto.js'
import { wallet } from '@cityofzion/neon-js'
import './Wallet.css'

export default class Wallet extends Component {
constructor(props) {
super(props)
const wif = crypto.getWifFromHex(props.data.private)
const publicKey = crypto.getPubFromHex(props.data.private)
const address = crypto.getAddrFromPri(props.data.private)
const acct = new wallet.Account(props.data.private)
const wif = acct.WIF
const publicKey = acct.publicKey
const address = acct.address
this.state = {
address,
wif,
Expand All @@ -20,15 +21,15 @@ export default class Wallet extends Component {
this.toggle = this.toggle.bind(this)
}

remove() {
remove () {
this.props.removeCallback(this.state.address)
}

toggle() {
toggle () {
this.props.toggleCallback(this.state.address, 'NEP2')
}

render() {
render () {
let leftAlign = { textAlign: 'left' }
const uiStyle = { flexGrow: 0, flexBasis: 0, width: 0 }
const cardStyle = { flexGrow: 1, margin: 0 }
Expand Down
103 changes: 0 additions & 103 deletions src/modules/crypto.js

This file was deleted.

55 changes: 0 additions & 55 deletions src/modules/crypto.test.js

This file was deleted.

Loading

0 comments on commit d967787

Please sign in to comment.