How to use the fs-json-store-encryption-adapter.EncryptionAdapter 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 / database / serialization.ts View on Github external
constructor(input: { key: Buffer, preset: EncryptionAdapterBundle.KeyBasedPreset }) {
        this.logger.info("constructor()");

        const encryptionAdapter = new EncryptionAdapterBundle.EncryptionAdapter(input);

        this.read = async (data: Buffer) => {
            this.logger.info(`read() buffer.length: ${data.length}`);

            const {header: {serialization}} = persistencePartsUtil.split(data);
            const decryptedData = await encryptionAdapter.read(data);

            if (serialization && serialization.type === "msgpack") {
                this.logger.verbose(`"msgpack.decode" start`);
                const decoded = msgpack.decode(decryptedData) as FsDb;
                this.logger.verbose(`"msgpack.decode" end`);
                return decoded;
            }

            const readableStream = bufferToStream(decryptedData);
github vladimiry / ElectronMail / src / electron-main / util.ts View on Github external
export async function buildSettingsAdapter(
    {configStore}: Context,
    password: string,
): Promise {
    return new EncryptionAdapter(
        {password, preset: (await configStore.readExisting()).encryptionPreset},
        {keyDerivationCache: true, keyDerivationCacheLimit: 3},
    );
}

fs-json-store-encryption-adapter

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

MIT
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis