@@ -1,10 +1,12 @@
11import React, { useState, useEffect, useCallback } from 'react';
22import { Just, Nothing } from 'folktale/maybe';
33import { Grid, P } from 'indigo-react';
4+import ob from 'urbit-ob';
45
56import * as need from 'lib/need';
67import { downloadWallet } from 'lib/invite';
78import { useLocalRouter } from 'lib/LocalRouter';
9+import { compileNetworkingKey } from 'lib/keys';
810
911import { DownloadButton, ForwardButton } from 'components/Buttons';
1012import PaperBuilder from 'components/PaperBuilder';
@@ -20,7 +22,7 @@ export default function PassportDownload({ className }) {
2022 setGenerated,
2123 } = useActivateFlow();
2224 const { push, names } = useLocalRouter();
23− // const point = need.point(derivedPoint);
25+ const point = need.point(derivedPoint);
2426 const wallet = need.wallet(derivedWallet);
2527
2628 const [paper, setPaper] = useState(Nothing());
@@ -32,9 +34,12 @@ export default function PassportDownload({ className }) {
3234 });
3335
3436 const download = useCallback(() => {
35− downloadWallet(paper.getOrElse([]));
37+ const netkey = compileNetworkingKey(wallet.network.keys, point, 1);
38+ //TODO could be deduplicated with useKeyfileGenerator's logic
39+ const filename = ob.patp(point).slice(1) + '-1.key';
40+ downloadWallet(paper.getOrElse([]), netkey, filename);
3641 setDownloaded(true);
37− }, [paper, setDownloaded]);
42+ }, [paper, wallet, point, setDownloaded]);
3843
3944 // sync paper value to activation state
4045 useEffect(