@@ -2,6 +2,7 @@ import React, { useCallback, useMemo, useRef, useState } from 'react';
2import { Just, Nothing } from 'folktale/maybe';
2import { Just, Nothing } from 'folktale/maybe';
3import { Grid, Text, H5, Flex, ToggleInput, CheckboxInput } from 'indigo-react';
3import { Grid, Text, H5, Flex, ToggleInput, CheckboxInput } from 'indigo-react';
4import * as azimuth from 'azimuth-js';
4import * as azimuth from 'azimuth-js';
5+import ob from 'urbit-ob';
5import { randomHex } from 'web3-utils';
6import { randomHex } from 'web3-utils';
7import { usePointCursor } from 'store/pointCursor';
8import { usePointCursor } from 'store/pointCursor';
@@ -73,6 +74,7 @@ function useSetKeys() {
75 available: keyfileAvailable,
76 available: keyfileAvailable,
76 bind: keyfileBind,
78 bind: keyfileBind,
77 } = useKeyfileGenerator(ndNetworkSeed);
79 } = useKeyfileGenerator(ndNetworkSeed);
@@ -136,6 +138,7 @@ function useSetKeys() {
137 completed,
139 completed,
138 ndNetworkSeed,
140 ndNetworkSeed,
139 keyfileBind,
142 keyfileBind,
@@ -156,6 +159,8 @@ export default function AdminNetworkingKeys() {
156 // since NaN > 0 === false and that's a reasonable result
159 // since NaN > 0 === false and that's a reasonable result
162+ const [usedDiscontinuity, setUsedDiscontinuity] = useState(false);
160 isDefaultState,
165 isDefaultState,
161 construct,
166 construct,
@@ -163,6 +168,7 @@ export default function AdminNetworkingKeys() {
163 broadcasting,
168 broadcasting,
164 completed,
169 completed,
165 inputsLocked,
170 inputsLocked,
167 keyfileBind,
173 keyfileBind,
168 } = useSetKeys();
174 } = useSetKeys();
@@ -193,6 +199,7 @@ export default function AdminNetworkingKeys() {
193 values.useNetworkSeed ? values.networkSeed : undefined,
199 values.useNetworkSeed ? values.networkSeed : undefined,
194 values.useDiscontinuity
200 values.useDiscontinuity
202+ setUsedDiscontinuity(values.useDiscontinuity);
197 unconstruct();
204 unconstruct();
@@ -201,7 +208,7 @@ export default function AdminNetworkingKeys() {
201 form.change('networkSeed', '');
208 form.change('networkSeed', '');
204− [construct, unconstruct]
211+ [construct, unconstruct, setUsedDiscontinuity]
207 const initialValues = useMemo(
214 const initialValues = useMemo(
@@ -214,6 +221,32 @@ export default function AdminNetworkingKeys() {
215 const goRelocate = useCallback(() => push(names.RELOCATE), [push, names]);
222 const goRelocate = useCallback(() => push(names.RELOCATE), [push, names]);
224+ const usageMessage = useMemo(() => {
225+ const need = 'You need this keyfile to authenticate with Arvo.';
228+ boot fresh with{' '}
230+ urbit -w {ob.patp(point).slice(1)} -k {filename}
234+ if (usedDiscontinuity) {
237+ {need} Since you broke continuity, (re)move your old files, and {boot}
243+ {need} If you have already booted Arvo, run{' '}
244+ <code>|rekey '0wkeyfile.contents'</code>. Otherwise, {boot}
248+ }, [usedDiscontinuity, filename, point]);
217 const renderTitle = () => {
250 const renderTitle = () => {
218 if (completed) {
251 if (completed) {
219 return 'Networking keys are now set. Download your Keyfile to authenticate Arvo.';
252 return 'Networking keys are now set. Download your Keyfile to authenticate Arvo.';
@@ -323,8 +356,7 @@ export default function AdminNetworkingKeys() {
323 {completed && (
356 {completed && (
325 <Grid.Item full as={NoticeBox} className="mb3">
358 <Grid.Item full as={NoticeBox} className="mb3">
326− You need this keyfile to authenticate with Arvo. If you have
359+ {usageMessage}
327− already booted Arvo, run <code>|rekey '0wkeyfile.contents'</code>
328 </Grid.Item>
360 </Grid.Item>
329 <Grid.Item full as={DownloadKeyfileButton} solid {...keyfileBind} />
361 <Grid.Item full as={DownloadKeyfileButton} solid {...keyfileBind} />