diff --git a/packages/core/data-transfer/lib/providers/local-file-destination-provider.ts b/packages/core/data-transfer/lib/providers/local-file-destination-provider.ts index 3347584360..64290853c4 100644 --- a/packages/core/data-transfer/lib/providers/local-file-destination-provider.ts +++ b/packages/core/data-transfer/lib/providers/local-file-destination-provider.ts @@ -4,9 +4,10 @@ import zip from 'zlib'; import { Duplex } from 'stream'; import { chain, Writable } from 'stream-chain'; import { stringer } from 'stream-json/jsonl/Stringer'; +import type { Cipher } from 'crypto'; import type { IDestinationProvider, ProviderType, Stream } from '../../types'; -// import { encrypt } from '../encryption'; +import { createCipher } from '../encryption/encrypt'; export interface ILocalFileDestinationProviderOptions { // Encryption @@ -37,6 +38,7 @@ class LocalFileDestinationProvider implements IDestinationProvider { name: string = 'destination::local-file'; type: ProviderType = 'destination'; options: ILocalFileDestinationProviderOptions; + cipher?: Cipher; constructor(options: ILocalFileDestinationProviderOptions) { this.options = options; @@ -88,9 +90,10 @@ class LocalFileDestinationProvider implements IDestinationProvider { } // Encryption - // if (options.encryption?.enabled) { - // streams.push(encrypt(options.encryption.key).cipher()); - // } + if (this.options.encryption?.enabled) { + this.cipher = createCipher(this.options.encryption.key); + streams.push(this.cipher); + } // FS write stream streams.push(createMultiFilesWriteStream(filePathFactory, this.options.file.maxSize));