add safe storage store

This commit is contained in:
Abhinav 2022-07-11 01:49:17 +05:30
parent a0779e9b2b
commit 73c3f8c45a
2 changed files with 27 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import Store, { Schema } from 'electron-store'; import Store, { Schema } from 'electron-store';
import { KeysStoreType, UploadStoreType } from '../types'; import { KeysStoreType, SafeStorageStoreType, UploadStoreType } from '../types';
export const uploadStoreSchema: Schema<UploadStoreType> = { export const uploadStoreSchema: Schema<UploadStoreType> = {
filePaths: { filePaths: {
@ -39,3 +39,19 @@ export const keysStore = new Store({
name: 'keys', name: 'keys',
schema: keysStoreSchema, schema: keysStoreSchema,
}); });
export const safeStorageSchema: Schema<SafeStorageStoreType> = {
encryptionKey: {
type: 'object',
properties: {
encryptedData: { type: 'string' },
key: { type: 'string' },
nonce: { type: 'string' },
},
},
};
export const safeStorage = new Store({
name: 'safeStorage',
schema: safeStorageSchema,
});

View file

@ -31,3 +31,13 @@ export const FILE_PATH_KEYS: {
[FILE_PATH_TYPE.ZIPS]: 'zipPaths', [FILE_PATH_TYPE.ZIPS]: 'zipPaths',
[FILE_PATH_TYPE.FILES]: 'filePaths', [FILE_PATH_TYPE.FILES]: 'filePaths',
}; };
interface KeyAttributes {
encryptedData: string;
key: string;
nonce: string;
}
export interface SafeStorageStoreType {
encryptionKey: KeyAttributes;
}