Migrate from electron-store to OS-level secure storage (getSecureStorage)

- Replace `electron-store` with OS-level encrypted storage for secure token, userId, and language management in `LocalSystem` and `keyManager`.
- Add `init-user` IPC handler to initialize user data and manage encryption keys.
- Update login process to handle encrypted storage saving with fallback for macOS issues.
- Add offline warning component to `login/page.tsx` to handle first-time sync requirements.
- Remove `electron-store` and associated dependencies from `package.json` and `package-lock.json`.
This commit is contained in:
natreex
2025-11-19 19:10:12 -05:00
parent 71d13e2b12
commit dde4683c38
11 changed files with 287 additions and 361 deletions

View File

@@ -212,6 +212,20 @@ function ScribeContent() {
}
return;
}
// Initialize user in Electron (sets userId and creates/gets encryption key)
if (window.electron && user.id) {
try {
const initResult = await window.electron.initUser(user.id);
if (!initResult.success) {
console.error('[Page] Failed to initialize user:', initResult.error);
} else {
console.log('[Page] User initialized successfully, key created:', initResult.keyCreated);
}
} catch (error) {
console.error('[Page] Error initializing user:', error);
}
}
setSession({
isConnected: true,
user: user,