fix(sqlite): enable database encryption in Electron app
The app is failing to initialize encryption because: - Database is created with 'no-encryption' mode - Capacitor SQLite plugin's encryption methods are available but unused - Secret table exists but encryption isn't properly initialized This commit will: - Enable encryption in database connection options - Initialize encryption secret before database open - Use Capacitor SQLite plugin's encryption methods - Ensure secret table is properly initialized This fixes the "No initial encryption supported" error that occurs when trying to save new identities or access encrypted data. Technical details: - Changes connection options to use 'secret' encryption mode - Adds setEncryptionSecret call before database open - Maintains existing secret table structure - Uses Capacitor SQLite plugin's native encryption support
This commit is contained in:
@@ -443,9 +443,7 @@ const MIGRATIONS: Migration[] = [
|
||||
);
|
||||
|
||||
-- Insert initial secret only if no secret exists
|
||||
INSERT INTO secret (id, secretBase64)
|
||||
SELECT 1, '${INITIAL_SECRET}'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM secret WHERE id = 1);
|
||||
INSERT OR IGNORE INTO secret (id, secretBase64) VALUES (1, '${INITIAL_SECRET}');
|
||||
|
||||
-- Settings table for user preferences and app state
|
||||
CREATE TABLE IF NOT EXISTS settings (
|
||||
@@ -481,9 +479,7 @@ const MIGRATIONS: Migration[] = [
|
||||
);
|
||||
|
||||
-- Insert default API server setting only if no settings exist
|
||||
INSERT INTO settings (id, apiServer)
|
||||
SELECT 1, '${DEFAULT_ENDORSER_API_SERVER}'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM settings WHERE id = 1);
|
||||
INSERT OR IGNORE INTO settings (id, apiServer) VALUES (1, '${DEFAULT_ENDORSER_API_SERVER}');
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_settings_accountDid ON settings(accountDid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user