on master help sign in
walletgen: normalize seed input to remove 0x
b75887fHunter Miller
src/lib/walletgen.js+3−1
@@ -14,6 +14,7 @@ import {
14 ZOD,
14 ZOD,
15} from './constants';
15} from './constants';
16import Worker from 'worker';
16import Worker from 'worker';
17+import { stripHexPrefix } from './utils/address';
17
18
18const worker = new Worker();
19const worker = new Worker();
19
20
@@ -59,7 +60,8 @@ export const makeDeterministicTicket = (point, seed) => {
59 Buffer.from(point.toString()),
60 Buffer.from(point.toString()),
60 Buffer.from('invites'),
61 Buffer.from('invites'),
61 ]);
62 ]);
63+ const normalizedSeed = stripHexPrefix(seed);
62− const entropy = shas(Buffer.from(seed, 'hex'), pointSalt);
64+ const entropy = shas(Buffer.from(normalizedSeed, 'hex'), pointSalt);
63
65
64 const buf = entropy.slice(0, bytes);
66 const buf = entropy.slice(0, bytes);
65 const patq = ob.hex2patq(buf.toString('hex'));
67 const patq = ob.hex2patq(buf.toString('hex'));