From 9d6fa488d6fdae9ee8209120c832fc3e082d887b Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Wed, 22 Jul 2020 15:52:11 +0200 Subject: [PATCH] feat: add schema for store, closes #162 --- app/utils/disk-store.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/utils/disk-store.ts b/app/utils/disk-store.ts index c4719841f..caa0be5ee 100644 --- a/app/utils/disk-store.ts +++ b/app/utils/disk-store.ts @@ -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); @@ -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,