diff --git a/src/electron-main.ts b/src/electron-main.ts index 70f8acf2..7937d18d 100644 --- a/src/electron-main.ts +++ b/src/electron-main.ts @@ -449,6 +449,8 @@ app.on("ready", async () => { console.log("No update_base_url is defined: auto update is disabled"); } + await store.safeStorageReady(); + // Load the previous window state with fallback to defaults const mainWindowState = windowStateKeeper({ defaultWidth: 1024, diff --git a/src/store.ts b/src/store.ts index 5bc70301..c122008d 100644 --- a/src/store.ts +++ b/src/store.ts @@ -74,9 +74,9 @@ class Store extends ElectronStore<{ } private whenSafeStorageReadyPromise?: Promise; - private safeStorageReady(): Promise { + public safeStorageReady(): Promise { if (!this.whenSafeStorageReadyPromise) { - this.whenSafeStorageReadyPromise = app.whenReady().then(() => this.migrate()); + this.whenSafeStorageReadyPromise = app.whenReady().then(() => this.migrateSecrets()); } return this.whenSafeStorageReadyPromise; } @@ -88,7 +88,7 @@ class Store extends ElectronStore<{ * deletes data from legacy keytar but keeps it in the new keytar for downgrade compatibility. * @throws if safeStorage is not available. */ - public async migrate(): Promise { + private async migrateSecrets(): Promise { if (this.has("safeStorage")) return; console.info("Store migration: started"); if (!safeStorage.isEncryptionAvailable()) {