@@ -2,6 +2,7 @@ import React, { useCallback, useMemo, useRef, useState } from 'react';
22import { Just, Nothing } from 'folktale/maybe';
33import { Grid, Text, H5, Flex, ToggleInput, CheckboxInput } from 'indigo-react';
44import * as azimuth from 'azimuth-js';
5+import ob from 'urbit-ob';
56import { randomHex } from 'web3-utils';
67
78import { usePointCursor } from 'store/pointCursor';
@@ -73,6 +74,7 @@ function useSetKeys() {
7374
7475 const {
7576 available: keyfileAvailable,
77+ filename,
7678 bind: keyfileBind,
7779 } = useKeyfileGenerator(ndNetworkSeed);
7880
@@ -136,6 +138,7 @@ function useSetKeys() {
136138 return {
137139 completed,
138140 ndNetworkSeed,
141+ filename,
139142 keyfileBind,
140143 ...rest,
141144 };
@@ -156,6 +159,8 @@ export default function AdminNetworkingKeys() {
156159 // since NaN > 0 === false and that's a reasonable result
157160 });
158161
162+ const [usedDiscontinuity, setUsedDiscontinuity] = useState(false);
163+
159164 const {
160165 isDefaultState,
161166 construct,
@@ -163,6 +168,7 @@ export default function AdminNetworkingKeys() {
163168 broadcasting,
164169 completed,
165170 inputsLocked,
171+ filename,
166172 bind,
167173 keyfileBind,
168174 } = useSetKeys();
@@ -193,6 +199,7 @@ export default function AdminNetworkingKeys() {
193199 values.useNetworkSeed ? values.networkSeed : undefined,
194200 values.useDiscontinuity
195201 );
202+ setUsedDiscontinuity(values.useDiscontinuity);
196203 } else {
197204 unconstruct();
198205 }
@@ -201,7 +208,7 @@ export default function AdminNetworkingKeys() {
201208 form.change('networkSeed', '');
202209 }
203210 },
204− [construct, unconstruct]
211+ [construct, unconstruct, setUsedDiscontinuity]
205212 );
206213
207214 const initialValues = useMemo(
@@ -214,6 +221,32 @@ export default function AdminNetworkingKeys() {
214221
215222 const goRelocate = useCallback(() => push(names.RELOCATE), [push, names]);
216223
224+ const usageMessage = useMemo(() => {
225+ const need = 'You need this keyfile to authenticate with Arvo.';
226+ const boot = (
227+ <>
228+ boot fresh with{' '}
229+ <code>
230+ urbit -w {ob.patp(point).slice(1)} -k {filename}
231+ </code>
232+ </>
233+ );
234+ if (usedDiscontinuity) {
235+ return (
236+ <>
237+ {need} Since you broke continuity, (re)move your old files, and {boot}
238+ </>
239+ );
240+ } else {
241+ return (
242+ <>
243+ {need} If you have already booted Arvo, run{' '}
244+ <code>|rekey '0wkeyfile.contents'</code>. Otherwise, {boot}
245+ </>
246+ );
247+ }
248+ }, [usedDiscontinuity, filename, point]);
249+
217250 const renderTitle = () => {
218251 if (completed) {
219252 return 'Networking keys are now set. Download your Keyfile to authenticate Arvo.';
@@ -323,8 +356,7 @@ export default function AdminNetworkingKeys() {
323356 {completed && (
324357 <>
325358 <Grid.Item full as={NoticeBox} className="mb3">
326− You need this keyfile to authenticate with Arvo. If you have
327− already booted Arvo, run <code>|rekey '0wkeyfile.contents'</code>
359+ {usageMessage}
328360 </Grid.Item>
329361 <Grid.Item full as={DownloadKeyfileButton} solid {...keyfileBind} />
330362 </>