Add proper secret generation using Node's crypto module and initial data setup
for the electron environment. This commit:
- Implements secure random secret generation using crypto.randomBytes()
- Adds initial data migrations (002) with:
- Secret table with cryptographically secure random key
- Settings table with default API server
- Contacts, logs, and temp tables
- Improves SQL parameter handling for migrations
- Adds proper transaction safety and rollback support
- Includes comprehensive logging and error handling
Security:
- Uses Node's crypto module for secure random generation
- Implements proper base64 encoding for secrets
- Maintains transaction safety for all operations
Testing:
- Verified database structure via sqlite3 CLI
- Confirmed successful migration execution
- Validated initial data insertion
- Checked index creation and constraints
Note: This is a temporary solution for secret storage until a more
secure storage mechanism is implemented.