on master help sign in
netkeys: custom hook handles new point login
commit3fc5a9c41b113af2c99d1515766c735a6be87d57 authortomholford <tomholford@users.noreply.github.com> dateMon 27 Sep 2021, 00:27 (5 years ago) parent441cb95
3 files changed+6−2
src/lib/types/L1Point.ts+1 src/lib/useHasNetworkKeysSet.tsx+2−1 src/store/lib/useDetailsStore.js → src/store/lib/useDetailsStore.ts+3−1
src/lib/types/L1Point.ts+1
@@ -4,6 +4,7 @@ export type L1Point = {
44 authenticationKey: string;
55 continuityNumber: string;
66 cryptoSuiteVersion: string;
7+ dominion?: string;
78 encryptionKey: string;
89 escapeRequested: boolean;
910 escapeRequestedTo: string;
src/lib/useHasNetworkKeysSet.tsx+2−1
@@ -1,5 +1,6 @@
11import { useEffect, useMemo, useState } from 'react';
22import * as need from 'lib/need';
3+import { Just } from 'folktale/maybe';
34import { usePointCache } from 'store/pointCache';
45import { usePointCursor } from 'store/pointCursor';
56import { convertToInt } from 'lib/convertToInt';
@@ -11,7 +12,7 @@ export const useHasNetworkKeysSet = () => {
1112 const [networkKeysSet, setNetworkKeysSet] = useState<boolean>(true);
1213
1314 useEffect(() => {
14− if (point) {
15+ if (point && Just.hasInstance(getDetails(point))) {
1516 const details = need.details(getDetails(point));
1617 const networkRevision = convertToInt(details.keyRevisionNumber, 10);
1718 setNetworkKeysSet(networkRevision > 0);
src/store/lib/useDetailsStore.js → src/store/lib/useDetailsStore.tsrenamed+3−1
@@ -4,8 +4,10 @@ import * as azimuth from 'azimuth-js';
44
55import useRoller from '../../lib/useRoller';
66import { useNetwork } from '../network';
7+import { L1Point } from 'lib/types/L1Point';
8+import { L2Point } from '@urbit/roller-api';
79
8−const toL1Details = point => {
10+const toL1Details = (point: L2Point): L1Point => {
911 return {
1012 dominion: 'l2',
1113 active: true,