/**
* Create Account screen.
* Generates a new Ed25519 + X25519 keypair and saves it securely.
*/
import React, { useState } from 'react';
import { View, Text, ScrollView, Alert } from 'react-native';
import { router } from 'expo-router';
import { generateKeyFile } from '@/lib/crypto';
import { saveKeyFile } from '@/lib/storage';
import { useStore } from '@/lib/store';
import { Button } from '@/components/ui/Button';
import { Input } from '@/components/ui/Input';
import { Card } from '@/components/ui/Card';
export default function CreateAccountScreen() {
const setKeyFile = useStore(s => s.setKeyFile);
const [loading, setLoading] = useState(false);
async function handleCreate() {
setLoading(true);
try {
const kf = generateKeyFile();
await saveKeyFile(kf);
setKeyFile(kf);
router.replace('/(auth)/created');
} catch (e: any) {
Alert.alert('Error', e.message);
} finally {
setLoading(false);
}
}
return (
{/* Header */}
Create Account
A new identity will be generated on your device.
Your private key never leaves this app.
{/* Info cards */}
⚠ Important
After creation, export and backup your key file.
If you lose it there is no recovery — the blockchain has no password reset.
);
}
function InfoRow({ icon, label, desc }: { icon: string; label: string; desc: string }) {
return (
{icon}{label}{desc}
);
}