diff --git a/README.md b/README.md index 47156350e3..e4398901f0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=element-desktop&metric=bugs)](https://sonarcloud.io/summary/new_code?id=element-desktop) # Element Desktop - +x Element Desktop is a Matrix client for desktop platforms with Element Web at its core. # First Steps diff --git a/src/seshat.ts b/src/seshat.ts index 2387349bfb..0a8537f108 100644 --- a/src/seshat.ts +++ b/src/seshat.ts @@ -43,7 +43,7 @@ const seshatDefaultPassphrase = "DEFAULT_PASSPHRASE"; async function getOrCreatePassphrase(store: Store, key: string): Promise { try { const storedPassphrase = await store.getSecret(key); - if (storedPassphrase !== null) { + if (storedPassphrase !== undefined) { return storedPassphrase; } } catch (e) { diff --git a/src/store.ts b/src/store.ts index cfe3f2f545..e7045e62f6 100644 --- a/src/store.ts +++ b/src/store.ts @@ -105,7 +105,7 @@ class StorageWriter { this.store.set(this.getKey(key), secret); } - public get(key: string): string | null { + public get(key: string): string | undefined { return this.store.get(this.getKey(key)); } @@ -122,7 +122,7 @@ class SafeStorageWriter extends StorageWriter { this.store.set(this.getKey(key), safeStorage.encryptString(secret).toString("base64")); } - public get(key: string): string | null { + public get(key: string): string | undefined { const ciphertext = this.store.get(this.getKey(key)); if (ciphertext) { try { @@ -132,7 +132,7 @@ class SafeStorageWriter extends StorageWriter { console.error("...ciphertext:", JSON.stringify(ciphertext)); } } - return null; + return undefined; } } @@ -462,7 +462,7 @@ class Store extends ElectronStore { * * @returns A promise for the secret string. */ - public async getSecret(key: string): Promise { + public async getSecret(key: string): Promise { await this.safeStorageReady(); let secret = this.secrets!.get(key); if (secret) return secret; @@ -518,9 +518,9 @@ class Store extends ElectronStore { /** * @deprecated will be removed in the near future */ - private async getSecretKeytar(key: string): Promise { + private async getSecretKeytar(key: string): Promise { return ( - (await keytar.getPassword(KEYTAR_SERVICE, key)) ?? (await keytar.getPassword(LEGACY_KEYTAR_SERVICE, key)) + (await keytar.getPassword(KEYTAR_SERVICE, key)) ?? (await keytar.getPassword(LEGACY_KEYTAR_SERVICE, key) ?? undefined) ); }