secure privkey
This commit is contained in:
@@ -1,17 +1,29 @@
|
||||
import { create } from 'zustand';
|
||||
import { createJSONStorage, persist } from 'zustand/middleware';
|
||||
|
||||
export const useOnboarding = create(
|
||||
persist(
|
||||
(set) => ({
|
||||
profile: {},
|
||||
createProfile: (data) => {
|
||||
set({ profile: data });
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: 'onboarding',
|
||||
storage: createJSONStorage(() => sessionStorage),
|
||||
}
|
||||
)
|
||||
);
|
||||
interface OnboardingState {
|
||||
profile: { [x: string]: string };
|
||||
pubkey: string;
|
||||
privkey: string;
|
||||
createProfile: (data: { [x: string]: string }) => void;
|
||||
setPubkey: (pubkey: string) => void;
|
||||
setPrivkey: (privkey: string) => void;
|
||||
clearPrivkey: (privkey: string) => void;
|
||||
}
|
||||
|
||||
export const useOnboarding = create<OnboardingState>((set) => ({
|
||||
profile: {},
|
||||
pubkey: '',
|
||||
privkey: '',
|
||||
createProfile: (data: { [x: string]: string }) => {
|
||||
set({ profile: data });
|
||||
},
|
||||
setPubkey: (pubkey: string) => {
|
||||
set({ pubkey: pubkey });
|
||||
},
|
||||
setPrivkey: (privkey: string) => {
|
||||
set({ privkey: privkey });
|
||||
},
|
||||
clearPrivkey: () => {
|
||||
set({ privkey: '' });
|
||||
},
|
||||
}));
|
||||
|
||||
13
src/stores/stronghold.tsx
Normal file
13
src/stores/stronghold.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface StrongholdState {
|
||||
password: null | string;
|
||||
setPassword: (password: string) => void;
|
||||
}
|
||||
|
||||
export const useStronghold = create<StrongholdState>((set) => ({
|
||||
password: null,
|
||||
setPassword: (password: string) => {
|
||||
set({ password: password });
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user