Commit 22a30164 authored by Marek Kotewicz's avatar Marek Kotewicz
Browse files

removed obsolete crypto functions

parent 253d5899
......@@ -10,8 +10,6 @@
},
"dependencies": {
"debounce": "^1.0.0",
"elliptic": "^6.3.2",
"js-sha3": "^0.5.7",
"react": "^15.4.2",
"react-native": "0.40.0",
"react-native-camera": "^0.5.1",
......
import { ec } from 'elliptic'
import { keccak_256 } from 'js-sha3'
var secp = new ec('secp256k1')
import { EthkeyBridge } from 'NativeModules'
export function keypairFromPhrase(phrase) {
var seed = keccak_256.array(phrase);
var kp;
for (var i = 0; i <= 16384 || !toAddress(kp = secp.keyFromPrivate(seed)).startsWith('00'); ++i)
seed = keccak_256.array(seed)
return kp
}
export function toAddress(kp) { return keccak_256(kp.getPublic('buffer').slice(1)).substr(24); }
export function brainWalletAddress(seed, callback) {
EthkeyBridge.brainWalletAddress(seed, callback)
}
export const brainWalletAddress = EthkeyBridge.brainWalletAddress;
export const brainWalletSecret = EthkeyBridge.brainWalletSecret;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment