Merge pull request #2343 from element-hq/midhun/move-further-top
Enable plain text encryption before checking if encryption is available
This commit is contained in:
13
src/store.ts
13
src/store.ts
@@ -241,6 +241,13 @@ class Store extends ElectronStore<StoreData> {
|
|||||||
// Linux safeStorage support is hellish, the support varies on the Desktop Environment used rather than the store itself.
|
// Linux safeStorage support is hellish, the support varies on the Desktop Environment used rather than the store itself.
|
||||||
// https://github.com/electron/electron/issues/39789 https://github.com/microsoft/vscode/issues/185212
|
// https://github.com/electron/electron/issues/39789 https://github.com/microsoft/vscode/issues/185212
|
||||||
const selectedSafeStorageBackend = safeStorage.getSelectedStorageBackend();
|
const selectedSafeStorageBackend = safeStorage.getSelectedStorageBackend();
|
||||||
|
|
||||||
|
// The following enables plain text encryption if the backend used is basic_text.
|
||||||
|
// It has no significance for any other backend.
|
||||||
|
// We do this early so that in case we end up using the basic_text backend (either because that's the only one available
|
||||||
|
// or as a fallback when the configured backend lacks encryption support), encryption is already turned on.
|
||||||
|
safeStorage.setUsePlainTextEncryption(true);
|
||||||
|
|
||||||
const isEncryptionAvailable = safeStorage.isEncryptionAvailable();
|
const isEncryptionAvailable = safeStorage.isEncryptionAvailable();
|
||||||
console.info(
|
console.info(
|
||||||
`safeStorage backend '${selectedSafeStorageBackend}' selected, '${safeStorageBackend}' in config, isEncryptionAvailable = ${isEncryptionAvailable}.`,
|
`safeStorage backend '${selectedSafeStorageBackend}' selected, '${safeStorageBackend}' in config, isEncryptionAvailable = ${isEncryptionAvailable}.`,
|
||||||
@@ -261,12 +268,6 @@ class Store extends ElectronStore<StoreData> {
|
|||||||
return this.upgradeLinuxBackend2();
|
return this.upgradeLinuxBackend2();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following enables plain text encryption if the backend used is basic_text.
|
|
||||||
// It has no significance for any other backend.
|
|
||||||
// We do this early so that in case we end up using the basic_text backend (either because that's the only one available
|
|
||||||
// or as a fallback when the configured backend lacks encryption support), encryption is already turned on.
|
|
||||||
safeStorage.setUsePlainTextEncryption(true);
|
|
||||||
|
|
||||||
// Whether we were using basic_text as a fallback before
|
// Whether we were using basic_text as a fallback before
|
||||||
const usingFallback = this.get("safeStorageBackendOverride") && safeStorageBackend === "basic_text";
|
const usingFallback = this.get("safeStorageBackendOverride") && safeStorageBackend === "basic_text";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user