update stronghold

This commit is contained in:
Ren Amamiya
2023-07-20 08:57:58 +07:00
parent a80477b40e
commit bbfdb139c6
16 changed files with 74 additions and 127 deletions

View File

@@ -32,12 +32,9 @@ export function CreateStep2Screen() {
const [passwordInput, setPasswordInput] = useState('password');
const [loading, setLoading] = useState(false);
const [privkey, setPassword] = useStronghold((state) => [
state.privkey,
state.setPassword,
]);
const pubkey = useOnboarding((state) => state.privkey);
const privkey = useStronghold((state) => state.privkey);
const pubkey = useOnboarding((state) => state.pubkey);
const { save } = useSecureStorage();
@@ -60,9 +57,6 @@ export function CreateStep2Screen() {
const onSubmit = async (data: { [x: string]: string }) => {
setLoading(true);
if (data.password.length > 3) {
// add password to local state
setPassword(data.password);
// save privkey to secure storage
await save(pubkey, privkey, data.password);

View File

@@ -137,7 +137,7 @@ export function CreateStep5Screen() {
};
const update = useMutation({
mutationFn: (follows: any) => {
mutationFn: (follows: string[]) => {
return updateAccount('follows', follows, account.pubkey);
},
onSuccess: () => {

View File

@@ -32,11 +32,8 @@ export function ImportStep2Screen() {
const [passwordInput, setPasswordInput] = useState('password');
const [loading, setLoading] = useState(false);
const [privkey, setPassword] = useStronghold((state) => [
state.privkey,
state.setPassword,
]);
const privkey = useStronghold((state) => state.privkey);
const pubkey = useOnboarding((state) => state.pubkey);
const { save } = useSecureStorage();
@@ -60,9 +57,6 @@ export function ImportStep2Screen() {
const onSubmit = async (data: { [x: string]: string }) => {
setLoading(true);
if (data.password.length > 3) {
// add password to local state
setPassword(data.password);
// save privkey to secure storage
await save(pubkey, privkey, data.password);
@@ -115,9 +109,9 @@ export function ImportStep2Screen() {
</div>
<div className="text-sm text-zinc-500">
<p>
Password is use to secure your key store in local machine, when you move
to other clients, you just need to copy your private key as nsec or
hexstring
Password is use to unlock app and secure your key store in local machine.
When you move to other clients, you just need to copy your private key as
nsec or hexstring
</p>
</div>
<span className="text-sm text-red-400">

View File

@@ -33,13 +33,10 @@ const resolver: Resolver<FormValues> = async (values) => {
export function MigrateScreen() {
const queryClient = useQueryClient();
const navigate = useNavigate();
const setPrivkey = useStronghold((state) => state.setPrivkey);
const [passwordInput, setPasswordInput] = useState('password');
const [loading, setLoading] = useState(false);
const [setPassword, setPrivkey] = useStronghold((state) => [
state.setPassword,
state.setPrivkey,
]);
const { account } = useAccount();
const { save } = useSecureStorage();
@@ -63,9 +60,6 @@ export function MigrateScreen() {
const onSubmit = async (data: { [x: string]: string }) => {
setLoading(true);
if (data.password.length > 3) {
// add password to local state
setPassword(data.password);
// load private in secure storage
try {
// save privkey to secure storage

View File

@@ -21,8 +21,7 @@ export function OnboardingScreen() {
// publish event
publish({
content:
'Running Lume, fighting for better future, join us here: https://lume.nu',
content: 'Running Lume, join with me: https://lume.nu',
kind: 1,
tags: [],
});
@@ -55,18 +54,15 @@ export function OnboardingScreen() {
<User pubkey={account.pubkey} time={Math.floor(Date.now() / 1000)} />
)}
<div className="-mt-6 select-text whitespace-pre-line break-words pl-[49px] text-base text-zinc-100">
<p>Running Lume, fighting for better future</p>
<p>
join us here:{' '}
<a
href="https://lume.nu"
className="font-normal text-fuchsia-500 no-underline hover:text-fuchsia-600"
target="_blank"
rel="noreferrer"
>
https://lume.nu
</a>
</p>
<p>Running Lume, join with me</p>
<a
href="https://lume.nu"
className="font-normal text-fuchsia-500 no-underline hover:text-fuchsia-600"
target="_blank"
rel="noreferrer"
>
https://lume.nu
</a>
</div>
</div>
</div>

View File

@@ -29,13 +29,10 @@ const resolver: Resolver<FormValues> = async (values) => {
export function UnlockScreen() {
const navigate = useNavigate();
const setPrivkey = useStronghold((state) => state.setPrivkey);
const [passwordInput, setPasswordInput] = useState('password');
const [loading, setLoading] = useState(false);
const [setPrivkey, setPassword] = useStronghold((state) => [
state.setPrivkey,
state.setPassword,
]);
const { account } = useAccount();
const { load } = useSecureStorage();
@@ -59,9 +56,6 @@ export function UnlockScreen() {
const onSubmit = async (data: { [x: string]: string }) => {
setLoading(true);
if (data.password.length > 3) {
// add password to local state
setPassword(data.password);
// load private in secure storage
try {
const privkey = await load(account.pubkey, data.password);