Skip to content

Commit

Permalink
fix: onboarding gate in ledger mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Jan 26, 2024
1 parent aa214c8 commit 07729b5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/routes/onboarding-gate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Navigate } from 'react-router-dom';
import { RouteUrls } from '@shared/route-urls';

import { useDefaultWalletSecretKey } from '@app/store/in-memory-key/in-memory-key.selectors';
import { useHasLedgerKeys } from '@app/store/ledger/ledger.selectors';
import { useCurrentKeyDetails } from '@app/store/software-keys/software-key.selectors';

function hasAlreadyMadeWalletAndPlaintextKeyInMemory(encryptedKey?: string, inMemoryKey?: string) {
Expand All @@ -20,10 +21,15 @@ interface OnboardingGateProps {
export function OnboardingGate({ children }: OnboardingGateProps) {
const keyDetails = useCurrentKeyDetails();
const currentInMemoryKey = useDefaultWalletSecretKey();
const isLedger = useHasLedgerKeys();

if (
keyDetails?.type === 'software' &&
hasAlreadyMadeWalletAndPlaintextKeyInMemory(keyDetails.encryptedSecretKey, currentInMemoryKey)
(keyDetails?.type === 'software' &&
hasAlreadyMadeWalletAndPlaintextKeyInMemory(
keyDetails.encryptedSecretKey,
currentInMemoryKey
)) ||
isLedger
) {
return <Navigate to={RouteUrls.Home} />;
}
Expand Down

0 comments on commit 07729b5

Please sign in to comment.