diff --git a/public/wallpapers/1.png b/public/wallpapers/1.png new file mode 100644 index 00000000..f401bc6c Binary files /dev/null and b/public/wallpapers/1.png differ diff --git a/src/app.tsx b/src/app.tsx index 81cf7faa..d3197cb7 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -24,7 +24,7 @@ export default function App() { const accountLoader = async () => { try { - const account = await db.checkAccount(); + const totalAccount = await db.checkAccount(); const stronghold = sessionStorage.getItem('stronghold'); const privkey = JSON.parse(stronghold).state.privkey || null; @@ -32,7 +32,7 @@ export default function App() { const onboarding = localStorage.getItem('onboarding'); const step = JSON.parse(onboarding).state.step || null; - if (!account) { + if (totalAccount === 0) { return redirect('/auth/welcome'); } else { if (step) { @@ -251,6 +251,13 @@ export default function App() { return { Component: UnlockScreen }; }, }, + { + path: 'lock', + async lazy() { + const { LockScreen } = await import('@app/auth/lock'); + return { Component: LockScreen }; + }, + }, { path: 'migrate', async lazy() { diff --git a/src/app/auth/create/step-2.tsx b/src/app/auth/create/step-2.tsx index 84e5dfab..56f485bb 100644 --- a/src/app/auth/create/step-2.tsx +++ b/src/app/auth/create/step-2.tsx @@ -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 }); diff --git a/src/app/auth/import/step-2.tsx b/src/app/auth/import/step-2.tsx index 42da6e81..e2975e8d 100644 --- a/src/app/auth/import/step-2.tsx +++ b/src/app/auth/import/step-2.tsx @@ -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 }); diff --git a/src/app/auth/lock.tsx b/src/app/auth/lock.tsx new file mode 100644 index 00000000..ce65e55d --- /dev/null +++ b/src/app/auth/lock.tsx @@ -0,0 +1,10 @@ +export function LockScreen() { + return ( +
+

TODO

+
+ ); +} diff --git a/src/app/auth/unlock.tsx b/src/app/auth/unlock.tsx index 4a8c2e4d..e4aa8d7d 100644 --- a/src/app/auth/unlock.tsx +++ b/src/app/auth/unlock.tsx @@ -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(false); const [loading, setLoading] = useState(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