import { NostrAccount } from "@lume/system"; import { Spinner } from "@lume/ui"; import { createLazyFileRoute } from "@tanstack/react-router"; import { useState } from "react"; import { toast } from "sonner"; export const Route = createLazyFileRoute("/auth/privkey")({ component: Screen, }); function Screen() { const navigate = Route.useNavigate(); const [key, setKey] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const submit = async () => { if (!key.startsWith("nsec1")) return toast.warning( "You need to enter a valid private key starts with nsec or ncryptsec", ); try { setLoading(true); const npub = await NostrAccount.saveAccount(key, password); if (npub) { navigate({ to: "/$account/home", params: { account: npub }, replace: true, }); } } catch (e) { setLoading(false); toast.error(e); } }; return (

Continue with Private Key

setKey(e.target.value)} className="px-3 border-transparent rounded-lg h-11 bg-neutral-100 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400" />
setPassword(e.target.value)} className="px-3 border-transparent rounded-lg h-11 bg-neutral-100 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:bg-white/10 dark:placeholder:text-neutral-400" />
); }