-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
33 lines (26 loc) · 808 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
var chalk = require('chalk');
global.jssha3 = require("js-sha3");
global.lodash = require("lodash");
global.crypto = require("./lib/monero/xmrInstance");
class XMR {
constructor({seed}) {
var first, second, spendKeys, viewKeys
if(seed.length !== 64) {
first = global.crypto.cn_fast_hash(seed)
} else {
first = global.crypto.sc_reduce32(seed)
}
spendKeys = global.crypto.generate_keys(first)
second = global.crypto.cn_fast_hash(first)
viewKeys = global.crypto.generate_keys(second)
this.keys = {
spend: spendKeys,
view: viewKeys
}
this.address = global.crypto.pubkeys_to_string(spendKeys.pub, viewKeys.pub)
}
}
global.XMR = XMR
console.log(chalk.bold.cyan(`Starting XMR Dev Tools...`));
require("repl").start({});