feat: expose safestorage backend information on linux (#38873)
* feat: expose safestorage backend information on linux
* Remove gnome-keyring
Refs 4609704
This commit is contained in:
parent
dc671804da
commit
34e7c3696a
9 changed files with 127 additions and 39 deletions
|
@ -6,15 +6,6 @@ import { ifdescribe } from './lib/spec-helpers';
|
|||
import * as fs from 'fs-extra';
|
||||
import { once } from 'node:events';
|
||||
|
||||
/* isEncryptionAvailable returns false in Linux when running CI due to a mocked dbus. This stops
|
||||
* Chrome from reaching the system's keyring or libsecret. When running the tests with config.store
|
||||
* set to basic-text, a nullptr is returned from chromium, defaulting the available encryption to false.
|
||||
*
|
||||
* Because all encryption methods are gated by isEncryptionAvailable, the methods will never return the correct values
|
||||
* when run on CI and linux.
|
||||
* Refs: https://github.com/electron/electron/issues/30424.
|
||||
*/
|
||||
|
||||
describe('safeStorage module', () => {
|
||||
it('safeStorage before and after app is ready', async () => {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'crash-cases', 'safe-storage');
|
||||
|
@ -33,7 +24,13 @@ describe('safeStorage module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform !== 'linux')('safeStorage module', () => {
|
||||
describe('safeStorage module', () => {
|
||||
before(() => {
|
||||
if (process.platform === 'linux') {
|
||||
safeStorage.setUsePlainTextEncryption(true);
|
||||
}
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
const pathToEncryptedString = path.resolve(__dirname, 'fixtures', 'api', 'safe-storage', 'encrypted.txt');
|
||||
if (await fs.pathExists(pathToEncryptedString)) {
|
||||
|
@ -47,6 +44,12 @@ ifdescribe(process.platform !== 'linux')('safeStorage module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'linux')('SafeStorage.getSelectedStorageBackend()', () => {
|
||||
it('should return a valid backend', () => {
|
||||
expect(safeStorage.getSelectedStorageBackend()).to.equal('basic_text');
|
||||
});
|
||||
});
|
||||
|
||||
describe('SafeStorage.encryptString()', () => {
|
||||
it('valid input should correctly encrypt string', () => {
|
||||
const plaintext = 'plaintext';
|
||||
|
@ -87,6 +90,7 @@ ifdescribe(process.platform !== 'linux')('safeStorage module', () => {
|
|||
}).to.throw(Error);
|
||||
});
|
||||
});
|
||||
|
||||
describe('safeStorage persists encryption key across app relaunch', () => {
|
||||
it('can decrypt after closing and reopening app', async () => {
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue