import { motion, useReducedMotion } from "motion/react"; import * as React from "react"; import { Button } from "@/shared/ui/button"; import { ONBOARDING_SECURITY_PRIMARY_CTA_CLASS, ONBOARDING_SECONDARY_CTA_CLASS, } from "./OnboardingChrome"; import { OnboardingFooter } from "./OnboardingFooter"; import { type OnboardingTransitionDirection, OnboardingSlideTransition, } from "./OnboardingSlideTransition"; import { type EncryptedBackupSession, EncryptedBackupCreator, } from "./EncryptedBackupCreator"; type DownloadKeyStepProps = { direction: OnboardingTransitionDirection; /** * Backup state owned by the parent flow so Back navigation (which unmounts * this step) doesn't discard the created backup, the entered password, or * the backup-test progress. */ session: EncryptedBackupSession; onBack: () => void; }; /** * Password-backup security subview within the identity-key onboarding step. * The raw key never enters this component: Rust builds the NIP-49 payload * locally and the native save dialog produces the user-owned file. */ export function DownloadKeyStep({ direction, session, onBack, }: DownloadKeyStepProps) { const reduceMotion = useReducedMotion() ?? false; // Once the encrypted payload is saved, the creator advances to its guided // backup test while this surface keeps its own navigation. const hasCreated = session.created; const [createButtonSlot, setCreateButtonSlot] = React.useState(null); return ( {/* Plain string concat: cn()'s tailwind-merge misreads the custom text-title size token as conflicting with text-foreground. */}

{hasCreated ? "Now, test your backup" : "Backup your key with a password"}

{hasCreated ? "Make sure your backup works: drop the file you just saved and unlock it with your password." : "Keep the downloaded file private — you need both it and your password to restore your identity. Save the backup password somewhere safe; Buzz cannot reset it if lost."}

{hasCreated ? null : (
)} ); }