How to use the function in fs-json-store-encryption-adapter

To help you get started, we’ve selected a few fs-json-store-encryption-adapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladimiry / ElectronMail / src / electron-main / api / index.spec.ts View on Github external
readSettings: async (t) => {
        const {
            mocks: {
                "src/electron-main/keytar": {setPassword: setPasswordSpy, deletePassword: deletePasswordSpy},
                "src/electron-main/storage-upgrade": {upgradeSettings: upgradeSettingsSpy},
                "src/electron-main/session": {initSessionByAccount: initSessionByAccountMock},
        } = t.context;

        t.false(await t.context.ctx.settingsStore.readable(), "settings file does not exist");
        t.falsy(t.context.ctx.settingsStore.adapter, "adapter is not set");
        const initial = await readConfigAndSettings(endpoints, {password: OPTIONS.masterPassword, savePassword: false});, upgradeSettingsSpy.callCount); &&,
            "adapter is an EncryptionAdapter",
        const initialExpected = {...t.context.ctx.initialStores.settings, ...{_rev: 0}};
        t.deepEqual(initial, initialExpected, "checking initial settings file");
        t.true(await t.context.ctx.settingsStore.readable(), "settings file exists");, 0);, 1);
        t.true(deletePasswordSpy.alwaysCalledWithExactly());, initSessionByAccountMock.callCount);
        for (const {login} of initial.accounts) {
            t.true(initSessionByAccountMock.calledWithExactly(t.context.ctx, login));

        const initialUpdated = await t.context.ctx.settingsStore.write(initial);
        const initialUpdatedExpected = {...initial, ...initialExpected, ...{_rev: initialExpected._rev + 1}};
        t.deepEqual(initialUpdated, initialUpdatedExpected, "saved initial settings file");


Encryption adapter for the "fs-json-store" module

Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis