@@ -18,10 +18,11 @@ import {
18import useCurrentPermissions from './useCurrentPermissions';
18import useCurrentPermissions from './useCurrentPermissions';
20export default function useKeyfileGenerator(manualNetworkSeed) {
20export default function useKeyfileGenerator(manualNetworkSeed) {
21− const { getDetails } = usePointCache();
22 const { urbitWallet, wallet, authMnemonic } = useWallet();
21 const { urbitWallet, wallet, authMnemonic } = useWallet();
23 const { pointCursor } = usePointCursor();
22 const { pointCursor } = usePointCursor();
23+ const { getDetails } = usePointCache();
25+ const [notice, setNotice] = useState('Deriving networking keys...');
25 const [downloaded, setDownloaded] = useState(false);
26 const [downloaded, setDownloaded] = useState(false);
26 const [generating, setGenerating] = useState(true);
27 const [generating, setGenerating] = useState(true);
27 const [keyfile, setKeyfile] = useState(false);
28 const [keyfile, setKeyfile] = useState(false);
@@ -36,12 +37,13 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
36 const available =
37 const available =
37 (isOwner || isManagementProxy) && hasNetworkingKeys && !!keyfile;
38 (isOwner || isManagementProxy) && hasNetworkingKeys && !!keyfile;
40− `keyfile available (${available}) for revision ${networkRevision}`
43 const generate = useCallback(async () => {
40 const generate = useCallback(async () => {
44− console.log('generating for network revision', networkRevision);
41+ console.log('attempting generation for network revision', networkRevision);
42+ if (!hasNetworkingKeys) {
43+ setGenerating(false);
44+ setNotice('Networking keys not yet set.');
46 const networkSeed = manualNetworkSeed
48 const networkSeed = manualNetworkSeed
47 ? Just(manualNetworkSeed)
49 ? Just(manualNetworkSeed)
@@ -55,7 +57,9 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
56 if (Nothing.hasInstance(networkSeed)) {
58 if (Nothing.hasInstance(networkSeed)) {
57 setGenerating(false);
59 setGenerating(false);
58− console.log('manual network seed not provided and key not derivable');
60+ setNotice(
61+ 'Custom or nondeterministic networking keys cannot be re-downloaded.'
@@ -65,14 +69,16 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
66 if (!keysMatchChain(pair, _details)) {
70 if (!keysMatchChain(pair, _details)) {
67 setGenerating(false);
71 setGenerating(false);
68− console.log('derived network keys do not match on-chain details');
72+ setNotice('Derived networking keys do not match on-chain details.');
72 setKeyfile(compileNetworkingKey(pair, _point, networkRevision));
77 setKeyfile(compileNetworkingKey(pair, _point, networkRevision));
73 setGenerating(false);
78 setGenerating(false);
75 networkRevision,
80 networkRevision,
76 manualNetworkSeed,
82 manualNetworkSeed,
77 urbitWallet,
83 urbitWallet,
@@ -101,6 +107,7 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
101 available,
107 available,
102 downloaded,
108 downloaded,
103 download,
109 download,
106 return { ...values, bind: values };
113 return { ...values, bind: values };