wip: multi account

This commit is contained in:
Ren Amamiya
2023-09-28 13:58:50 +07:00
parent 0e6fc65b08
commit 4f4e2f5ccd
11 changed files with 59 additions and 30 deletions

View File

@@ -66,7 +66,7 @@ export function CreateStep2Screen() {
if (!db.secureDB) db.secureDB = stronghold;
// save privkey to secure storage
await db.secureSave(pubkey, privkey);
await db.secureSave(pubkey, privkey, pubkey);
// redirect to next step
navigate('/auth/create/step-3', { replace: true });

View File

@@ -66,7 +66,7 @@ export function ImportStep2Screen() {
if (!db.secureDB) db.secureDB = stronghold;
// save privkey to secure storage
await db.secureSave(pubkey, privkey);
await db.secureSave(pubkey, privkey, pubkey);
// redirect to next step
navigate('/auth/import/step-3', { replace: true });

10
src/app/auth/lock.tsx Normal file
View File

@@ -0,0 +1,10 @@
export function LockScreen() {
return (
<div
className="h-full w-full bg-cover bg-center"
style={{ backgroundImage: 'url(/wallpapers/1.png)' }}
>
<p>TODO</p>
</div>
);
}

View File

@@ -33,6 +33,7 @@ export function UnlockScreen() {
const navigate = useNavigate();
const setPrivkey = useStronghold((state) => state.setPrivkey);
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
const resetStronghold = useStronghold((state) => state.reset);
const [showPassword, setShowPassword] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
@@ -73,6 +74,8 @@ export function UnlockScreen() {
const logout = async () => {
// remove account
db.accountLogout();
// reset stronghold
resetStronghold();
// redirect to welcome screen
navigate('/auth/welcome');
};
@@ -146,7 +149,7 @@ export function UnlockScreen() {
to="/auth/reset"
className="inline-flex h-10 w-full items-center justify-center rounded-lg text-center text-sm font-medium text-white/70 hover:bg-white/20"
>
Reset password if you still have private key
Reset password if you still have a private key
</Link>
<button
type="button"

View File

@@ -68,7 +68,7 @@ export function SplashScreen() {
</h3>
{ndk ? (
<p className="text-sm text-white/50">
Ensure all your data is sync across all Nostr clients, it may take a few
Ensure all your data is sync across all Nostr clients. It may take a few
seconds, please don&apos;t close app.
</p>
) : null}