add safe storage store
This commit is contained in:
parent
a0779e9b2b
commit
73c3f8c45a
|
@ -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,
|
||||||
|
});
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue