import { CheckIcon } from "@lume/icons"; import { Spinner } from "@lume/ui"; import { displayNsec } from "@lume/utils"; import * as Checkbox from "@radix-ui/react-checkbox"; import { createFileRoute, useNavigate } from "@tanstack/react-router"; import { invoke } from "@tauri-apps/api/core"; import { writeText } from "@tauri-apps/plugin-clipboard-manager"; import { message } from "@tauri-apps/plugin-dialog"; import { useState } from "react"; import { useTranslation } from "react-i18next"; export const Route = createFileRoute("/auth/$account/backup")({ component: Screen, }); function Screen() { const { account } = Route.useParams(); const { t } = useTranslation(); const [key, setKey] = useState(null); const [passphase, setPassphase] = useState(""); const [copied, setCopied] = useState(false); const [loading, setLoading] = useState(false); const [confirm, setConfirm] = useState({ c1: false, c2: false, c3: false }); const navigate = useNavigate(); const submit = async () => { try { if (key) { if (!confirm.c1 || !confirm.c2 || !confirm.c3) { return await message("You need to confirm before continue", { title: "Backup", kind: "info", }); } navigate({ to: "/", replace: true }); } // start loading setLoading(true); invoke("get_encrypted_key", { npub: account, password: passphase, }).then((encrypted: string) => { // update state setKey(encrypted); setLoading(false); }); } catch (e) { setLoading(false); await message(String(e), { title: "Backup", kind: "error", }); } }; const copyKey = async () => { try { await writeText(key); setCopied(true); } catch (e) { await message(String(e), { title: "Backup", kind: "error", }); } }; return (
It's use for login to Lume or other Nostr clients. You will lost access to your account if you lose this key.