Remove Story model handling verbal styles and linguistic properties
- Delete `Story` model implementation including `getVerbesStyle` method and related properties. - Cleanup unused interfaces and redundant logic from the codebase.
This commit is contained in:
48
electron/database/keyManager.ts
Normal file
48
electron/database/keyManager.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import Store from 'electron-store';
|
||||
|
||||
/**
|
||||
* Key Manager - Manages user encryption keys stored in electron-store
|
||||
*/
|
||||
|
||||
const store = new Store({
|
||||
encryptionKey: 'eritors-scribe-secure-key'
|
||||
});
|
||||
|
||||
/**
|
||||
* Get user encryption key from secure store
|
||||
* @param userId - User ID
|
||||
* @returns User's encryption key or null if not found
|
||||
*/
|
||||
export function getUserEncryptionKey(userId: string): string {
|
||||
const key: string | undefined = store.get(`encryptionKey-${userId}`) as string | undefined;
|
||||
if (key === undefined) {
|
||||
throw new Error(`Unknown encryptionKey`);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user encryption key in secure store
|
||||
* @param userId - User ID
|
||||
* @param encryptionKey - Encryption key to store
|
||||
*/
|
||||
export function setUserEncryptionKey(userId: string, encryptionKey: string): void {
|
||||
store.set(`encryptionKey-${userId}`, encryptionKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has an encryption key
|
||||
* @param userId - User ID
|
||||
* @returns True if key exists
|
||||
*/
|
||||
export function hasUserEncryptionKey(userId: string): boolean {
|
||||
return store.has(`encryptionKey-${userId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user encryption key
|
||||
* @param userId - User ID
|
||||
*/
|
||||
export function deleteUserEncryptionKey(userId: string): void {
|
||||
store.delete(`encryptionKey-${userId}`);
|
||||
}
|
||||
Reference in New Issue
Block a user