@@ -2,6 +2,7 @@ import ob from 'urbit-ob';
22import kg from 'urbit-key-generation';
33import * as more from 'more-entropy';
44import { chunk, flatMap, zipWith } from 'lodash';
5+import { shax, shas } from 'lib/networkCode';
56
67import {
78 MIN_STAR,
@@ -44,6 +45,27 @@ export const makeTicket = point => {
4445 });
4546};
4647
48+export const makeDeterministicTicket = (point, seed) => {
49+ const bits =
50+ point < MIN_STAR
51+ ? GALAXY_ENTROPY_BITS
52+ : point < MIN_PLANET
53+ ? STAR_ENTROPY_BITS
54+ : PLANET_ENTROPY_BITS;
55+
56+ const bytes = bits / 8;
57+
58+ const pointSalt = Buffer.concat([
59+ Buffer.from(point.toString()),
60+ Buffer.from('invites'),
61+ ]);
62+ const entropy = shas(seed, pointSalt);
63+
64+ const buf = entropy.slice(0, bytes);
65+ const patq = ob.hex2patq(buf.toString('hex'));
66+ return patq;
67+};
68+
4769// return a wallet object
4870export const generateWallet = async (point, ticket, boot) => {
4971 const config = {