@@ -15,19 +15,10 @@ import { BRIDGE_ERROR } from '../lib/error'
15import { Row, Col, Warning, Button, H1, H3 } from '../components/Base'
15import { Row, Col, Warning, Button, H1, H3 } from '../components/Base'
17// for wallet generation
17// for wallet generation
18−import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
18+import * as wg from '../../walletgen/lib/lib'
19−import * as more from 'more-entropy'
20−import lodash from 'lodash'
21import PaperCollateralRenderer from 'PaperCollateralRenderer'
19import PaperCollateralRenderer from 'PaperCollateralRenderer'
22import JSZip from 'jszip'
20import JSZip from 'jszip'
23import saveAs from 'file-saver'
21import saveAs from 'file-saver'
24−import { MAX_GALAXY, MIN_STAR, MAX_STAR, MIN_PLANET,
25− GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
28− } from '../../walletgen/lib/constants'
29−const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
30−const NEXT_STEP_NUM = 6;
32class InviteWallet extends React.Component {
23class InviteWallet extends React.Component {
@@ -74,63 +65,10 @@ class InviteWallet extends React.Component {
77− //TODO pulled from walletgen/views/Generate and Download, put into lib
78 async generateWallet(point) {
68 async generateWallet(point) {
79− const makeTicket = point => {
69+ const ticket = await wg.makeTicket(point);
81− const bits = point < MIN_STAR
82− ? GALAXY_ENTROPY_BITS
85− : PLANET_ENTROPY_BITS
87− const bytes = bits / 8
88− const some = new Uint8Array(bytes)
89− window.crypto.getRandomValues(some)
91− const gen = new more.Generator()
93− return new Promise((resolve, reject) => {
94− gen.generate(bits, result => {
95− const chunked = lodash.chunk(result, 2)
96− const desired = chunked.slice(0, bytes) // only take required entropy
97− const more = lodash.flatMap(desired, arr => arr[0] ^ arr[1])
98− const entropy = lodash.zipWith(some, more, (x, y) => x ^ y)
99− const buf = Buffer.from(entropy)
100− const patq = ob.hex2patq(buf.toString('hex'))
102− reject('Entropy generation failed')
107− const genWallet = async (point, ticket, cb) => {
111− seedSize: SEED_LENGTH_BYTES,
115− boot: false //TODO should this generate networking keys here already?
118− const wallet = await kg.generateWallet(config);
70+ const wallet = await wg.generateWallet(point, ticket);
120− // This is here to notify the anyone who opens console because the thread
121− // hangs, blocking UI updates so this cannot be doen in the UI
122− console.log('Generating Wallet for point address: ', point);
127− const ticket = await makeTicket(point);
129− const wallet = await genWallet(point, ticket);
131 this.setState({ wallet: Just(wallet) });
71 this.setState({ wallet: Just(wallet) });
132− console.log('got wallet', wallet);
133− console.log('should start rendering now');
136 download() {
74 download() {