Skip to content

Commit

Permalink
feat: add schema for store, closes #162
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Sep 25, 2020
1 parent 847a6df commit 9d6fa48
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/utils/disk-store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import Store from 'electron-store';

const store = new Store();
const store = new Store({
schema: {
salt: {
type: 'string',
maxLength: 29,
minLength: 29,
},
encryptedMnemonic: {
type: 'string',
},
},
});

export const persistEncryptedMnemonic = (encryptedMnemonic: string) => {
store.set('encryptedMnemonic', encryptedMnemonic);
Expand All @@ -10,8 +21,6 @@ export const persistSalt = (salt: string) => {
store.set('salt', salt);
};

export const getPrivateKey = () => (store.get('privateKey') || null) as string | null;

export const getInitialStateFromDisk = () => {
return {
salt: store.get('salt') as string,
Expand Down

0 comments on commit 9d6fa48

Please sign in to comment.