From ef5d48dec2c129d433a38db520644c5ebd869279 Mon Sep 17 00:00:00 2001 From: Corey MacBook Pro Date: Sat, 24 Oct 2020 09:11:59 -0400 Subject: [PATCH 1/7] Switch from fileKey to encryptionKey --- README.md | 24 ++++++++++++------------ index.js | 18 +++++++++--------- spec/secureFiles.spec.js | 36 ++++++++++++++++++------------------ 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 717ee7d..ab00a48 100644 --- a/README.md +++ b/README.md @@ -25,21 +25,21 @@ When using parse-server-fs-adapter across multiple parse-server instances it's i "module": "@parse/fs-files-adapter", "options": { "filesSubDirectory": "my/files/folder", // optional - "fileKey": "someKey" //optional, but mandatory if you want to encrypt files + "encryptionKey": "someKey" //optional, but mandatory if you want to encrypt files } } } ``` ### Passing as an instance -***Notice: If used with parse-server versions <= 4.2.0, DO NOT PASS in `PARSE_SERVER_FILE_KEY` or `fileKey` from parse-server. Instead pass your key directly to `FSFilesAdapter` using your own environment variable or hardcoding the string. parse-server versions > 4.2.0 can pass in `PARSE_SERVER_FILE_KEY` or `fileKey`.*** +***Notice: If used with parse-server versions <= 4.2.0, DO NOT PASS in `PARSE_SERVER_FILE_KEY` or `encryptionKey` from parse-server. Instead pass your key directly to `FSFilesAdapter` using your own environment variable or hardcoding the string. parse-server versions > 4.2.0 can pass in `PARSE_SERVER_FILE_KEY` or `encryptionKey`.*** ```javascript var FSFilesAdapter = require('@parse/fs-files-adapter'); var fsAdapter = new FSFilesAdapter({ "filesSubDirectory": "my/files/folder", // optional - "fileKey": "someKey" //optional, but mandatory if you want to encrypt files + "encryptionKey": "someKey" //optional, but mandatory if you want to encrypt files }); var api = new ParseServer({ @@ -49,8 +49,8 @@ var api = new ParseServer({ }) ``` -### Rotating to a new fileKey -Periodically you may want to rotate your fileKey for security reasons. When this is the case, you can start up a development parse-server that has the same configuration as your production server. In the development server, initialize the file adapter with the new key and do the following in your `index.js`: +### Rotating to a new encryptionKey +Periodically you may want to rotate your encryptionKey for security reasons. When this is the case, you can start up a development parse-server that has the same configuration as your production server. In the development server, initialize the file adapter with the new key and do the following in your `index.js`: #### Files were previously unencrypted and you want to encrypt ```javascript @@ -58,7 +58,7 @@ var FSFilesAdapter = require('@parse/fs-files-adapter'); var fsAdapter = new FSFilesAdapter({ "filesSubDirectory": "my/files/folder", // optional - "fileKey": "newKey" //Use the newKey + "encryptionKey": "newKey" //Use the newKey }); var api = new ParseServer({ @@ -69,28 +69,28 @@ var api = new ParseServer({ //This can take awhile depending on how many files and how larger they are. It will attempt to rotate the key of all files in your filesSubDirectory //It is not recommended to do this on the production server, deploy a development server to complete the process. -const {rotated, notRotated} = await api.filesAdapter.rotateFileKey(); +const {rotated, notRotated} = await api.filesAdapter.rotateEncryptionKey(); console.log('Files rotated to newKey: ' + rotated); console.log('Files that couldn't be rotated to newKey: ' + notRotated); ``` -After successfully rotating your key, you should change the `fileKey` to `newKey` on your production server and then restart the server. +After successfully rotating your key, you should change the `encryptionKey` to `newKey` on your production server and then restart the server. #### Files were previously encrypted with `oldKey` and you want to encrypt with `newKey` -The same process as above, but pass in your `oldKey` to `rotateFileKey()`. +The same process as above, but pass in your `oldKey` to `rotateEncryptionKey()`. ```javascript //This can take awhile depending on how many files and how larger they are. It will attempt to rotate the key of all files in your filesSubDirectory -const {rotated, notRotated} = await api.filesAdapter.rotateFileKey({oldKey: oldKey}); +const {rotated, notRotated} = await api.filesAdapter.rotateEncryptionKey({oldKey: oldKey}); console.log('Files rotated to newKey: ' + rotated); console.log('Files that couldn't be rotated to newKey: ' + notRotated); ``` #### Only rotate a select list of files that were previously encrypted with `oldKey` and you want to encrypt with `newKey` -This is useful if for some reason there errors and some of the files werent rotated and returned in `notRotated`. The same process as above, but pass in your `oldKey` along with the array of `fileNames` to `rotateFileKey()`. +This is useful if for some reason there errors and some of the files werent rotated and returned in `notRotated`. The same process as above, but pass in your `oldKey` along with the array of `fileNames` to `rotateEncryptionKey()`. ```javascript //This can take awhile depending on how many files and how larger they are. It will attempt to rotate the key of all files in your filesSubDirectory -const {rotated, notRotated} = await api.filesAdapter.rotateFileKey({oldKey: oldKey, fileNames: ["fileName1.png","fileName2.png"]}); +const {rotated, notRotated} = await api.filesAdapter.rotateEncryptionKey({oldKey: oldKey, fileNames: ["fileName1.png","fileName2.png"]}); console.log('Files rotated to newKey: ' + rotated); console.log('Files that couldn't be rotated to newKey: ' + notRotated); ``` diff --git a/index.js b/index.js index f17727f..5c70b7c 100644 --- a/index.js +++ b/index.js @@ -12,10 +12,10 @@ const algorithm = 'aes-256-gcm'; function FileSystemAdapter(options) { options = options || {}; - this._fileKey = null; + this._encryptionKey = null; - if (options.fileKey !== undefined){ - this._fileKey = crypto.createHash('sha256').update(String(options.fileKey)).digest('base64').substr(0, 32); + if (options.encryptionKey !== undefined){ + this._encryptionKey = crypto.createHash('sha256').update(String(options.encryptionKey)).digest('base64').substr(0, 32); } let filesSubDirectory = options.filesSubDirectory || ''; this._filesDir = filesSubDirectory; @@ -30,11 +30,11 @@ FileSystemAdapter.prototype.createFile = function(filename, data) { const stream = fs.createWriteStream(filepath); return new Promise((resolve, reject) => { try{ - if(this._fileKey !== null){ + if(this._encryptionKey !== null){ const iv = crypto.randomBytes(16); const cipher = crypto.createCipheriv( algorithm, - this._fileKey, + this._encryptionKey, iv ); const encryptedResult = Buffer.concat([ @@ -96,14 +96,14 @@ FileSystemAdapter.prototype.getFileData = function(filename) { }); stream.on('end', () => { const data = Buffer.concat(chunks); - if(this._fileKey !== null){ + if(this._encryptionKey !== null){ const authTagLocation = data.length - 16; const ivLocation = data.length - 32; const authTag = data.slice(authTagLocation); const iv = data.slice(ivLocation,authTagLocation); const encrypted = data.slice(0,ivLocation); try{ - const decipher = crypto.createDecipheriv(algorithm, this._fileKey, iv); + const decipher = crypto.createDecipheriv(algorithm, this._encryptionKey, iv); decipher.setAuthTag(authTag); const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]); return resolve(decrypted); @@ -119,12 +119,12 @@ FileSystemAdapter.prototype.getFileData = function(filename) { }); } -FileSystemAdapter.prototype.rotateFileKey = function(options = {}) { +FileSystemAdapter.prototype.rotateEncryptionKey = function(options = {}) { const applicationDir = this._getApplicationDir(); var fileNames = []; var oldKeyFileAdapter = {}; if (options.oldKey !== undefined) { - oldKeyFileAdapter = new FileSystemAdapter({filesSubDirectory: this._filesDir, fileKey: options.oldKey}); + oldKeyFileAdapter = new FileSystemAdapter({filesSubDirectory: this._filesDir, encryptionKey: options.oldKey}); }else{ oldKeyFileAdapter = new FileSystemAdapter({filesSubDirectory: this._filesDir}); } diff --git a/spec/secureFiles.spec.js b/spec/secureFiles.spec.js index acf68e4..ec39122 100644 --- a/spec/secureFiles.spec.js +++ b/spec/secureFiles.spec.js @@ -22,7 +22,7 @@ describe('File encryption tests', () => { it("should save encrypted file", async function(done) { var adapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' + encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' }); var filename = 'file2.txt'; const filePath = 'files/'+directory+'/'+filename; @@ -41,7 +41,7 @@ describe('File encryption tests', () => { }); const encryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' + encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' }); const fileName1 = 'file1.txt'; const data1 = "hello world"; @@ -61,7 +61,7 @@ describe('File encryption tests', () => { expect(result.toString('utf-8')).toEqual(data2); const unEncryptedData2 = fs.readFileSync(filePath2); //Check if encrypted adapter can read data and make sure it's not the same as unEncrypted adapter - const {rotated, notRotated} = await encryptedAdapter.rotateFileKey(); + const {rotated, notRotated} = await encryptedAdapter.rotateEncryptionKey(); expect(rotated.length).toEqual(2); expect(rotated.filter(function(value){ return value === fileName1;}).length).toEqual(1); expect(rotated.filter(function(value){ return value === fileName2;}).length).toEqual(1); @@ -80,14 +80,14 @@ describe('File encryption tests', () => { }, 5000); it("should rotate key of all old encrypted files to files encrypted with a new key", async function(done) { - const oldFileKey = 'oldKeyThatILoved'; + const oldEncryptionKey = 'oldKeyThatILoved'; const oldEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: oldFileKey + encryptionKey: oldEncryptionKey }); const encryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: 'newKeyThatILove' + encryptionKey: 'newKeyThatILove' }); const fileName1 = 'file1.txt'; const data1 = "hello world"; @@ -107,7 +107,7 @@ describe('File encryption tests', () => { expect(result.toString('utf-8')).toEqual(data2); const oldEncryptedData2 = fs.readFileSync(filePath2); //Check if encrypted adapter can read data and make sure it's not the same as unEncrypted adapter - const {rotated, notRotated} = await encryptedAdapter.rotateFileKey({oldKey: oldFileKey}); + const {rotated, notRotated} = await encryptedAdapter.rotateEncryptionKey({oldKey: oldEncryptionKey}); expect(rotated.length).toEqual(2); expect(rotated.filter(function(value){ return value === fileName1;}).length).toEqual(1); expect(rotated.filter(function(value){ return value === fileName2;}).length).toEqual(1); @@ -126,10 +126,10 @@ describe('File encryption tests', () => { }, 5000); it("should rotate key of all old encrypted files to unencrypted files", async function(done) { - const oldFileKey = 'oldKeyThatILoved'; + const oldEncryptionKey = 'oldKeyThatILoved'; const oldEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: oldFileKey + encryptionKey: oldEncryptionKey }); const unEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory @@ -152,7 +152,7 @@ describe('File encryption tests', () => { expect(result.toString('utf-8')).toEqual(data2); const oldEncryptedData2 = fs.readFileSync(filePath2); //Check if unEncrypted adapter can read data and make sure it's not the same as oldEncrypted adapter - const {rotated, notRotated} = await unEncryptedAdapter.rotateFileKey({oldKey: oldFileKey}); + const {rotated, notRotated} = await unEncryptedAdapter.rotateEncryptionKey({oldKey: oldEncryptionKey}); expect(rotated.length).toEqual(2); expect(rotated.filter(function(value){ return value === fileName1;}).length).toEqual(1); expect(rotated.filter(function(value){ return value === fileName2;}).length).toEqual(1); @@ -171,14 +171,14 @@ describe('File encryption tests', () => { }, 5000); it("should only encrypt specified fileNames with the new key", async function(done) { - const oldFileKey = 'oldKeyThatILoved'; + const oldEncryptionKey = 'oldKeyThatILoved'; const oldEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: oldFileKey + encryptionKey: oldEncryptionKey }); const encryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: 'newKeyThatILove' + encryptionKey: 'newKeyThatILove' }); const unEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory @@ -205,7 +205,7 @@ describe('File encryption tests', () => { const data3 = "hello past world"; await unEncryptedAdapter.createFile(fileName3, data3, 'text/utf8'); //Check if encrypted adapter can read data and make sure it's not the same as unEncrypted adapter - const {rotated, notRotated} = await encryptedAdapter.rotateFileKey({oldKey: oldFileKey, fileNames: [fileName1,fileName2]}); + const {rotated, notRotated} = await encryptedAdapter.rotateEncryptionKey({oldKey: oldEncryptionKey, fileNames: [fileName1,fileName2]}); expect(rotated.length).toEqual(2); expect(rotated.filter(function(value){ return value === fileName1;}).length).toEqual(1); expect(rotated.filter(function(value){ return value === fileName2;}).length).toEqual(1); @@ -225,14 +225,14 @@ describe('File encryption tests', () => { }, 5000); it("should return fileNames of those it can't encrypt with the new key", async function(done) { - const oldFileKey = 'oldKeyThatILoved'; + const oldEncryptionKey = 'oldKeyThatILoved'; const oldEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: oldFileKey + encryptionKey: oldEncryptionKey }); const encryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory, - fileKey: 'newKeyThatILove' + encryptionKey: 'newKeyThatILove' }); const unEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory @@ -263,7 +263,7 @@ describe('File encryption tests', () => { expect(result instanceof Buffer).toBe(true); expect(result.toString('utf-8')).toEqual(data3); //Check if encrypted adapter can read data and make sure it's not the same as unEncrypted adapter - const {rotated, notRotated} = await encryptedAdapter.rotateFileKey({oldKey: oldFileKey}); + const {rotated, notRotated} = await encryptedAdapter.rotateEncryptionKey({oldKey: oldEncryptionKey}); expect(rotated.length).toEqual(2); expect(rotated.filter(function(value){ return value === fileName1;}).length).toEqual(1); expect(rotated.filter(function(value){ return value === fileName2;}).length).toEqual(1); From 6afb3698ea324e2378480f22fd9cf7f00e128f05 Mon Sep 17 00:00:00 2001 From: Corey MacBook Pro Date: Sat, 24 Oct 2020 09:33:06 -0400 Subject: [PATCH 2/7] remove old notice --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ab00a48..eddfcc1 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ When using parse-server-fs-adapter across multiple parse-server instances it's i ``` ### Passing as an instance -***Notice: If used with parse-server versions <= 4.2.0, DO NOT PASS in `PARSE_SERVER_FILE_KEY` or `encryptionKey` from parse-server. Instead pass your key directly to `FSFilesAdapter` using your own environment variable or hardcoding the string. parse-server versions > 4.2.0 can pass in `PARSE_SERVER_FILE_KEY` or `encryptionKey`.*** ```javascript var FSFilesAdapter = require('@parse/fs-files-adapter'); From 2b0186474f0666d6fe6686123289b0dfc768ded3 Mon Sep 17 00:00:00 2001 From: Corey's iMac Date: Sat, 24 Oct 2020 14:24:03 -0400 Subject: [PATCH 3/7] add default file location info and tests --- .gitignore | 3 +++ README.md | 6 +++--- spec/secureFiles.spec.js | 17 ++++++++++++++++- spec/test.spec.js | 6 ++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e920c16..e999e30 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ pids *.pid *.seed +#Test file creation directory +files + # Directory for instrumented libs generated by jscoverage/JSCover lib-cov diff --git a/README.md b/README.md index eddfcc1..2d62641 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ When using parse-server-fs-adapter across multiple parse-server instances it's i "filesAdapter": { "module": "@parse/fs-files-adapter", "options": { - "filesSubDirectory": "my/files/folder", // optional + "filesSubDirectory": "my/files/folder", // optional, defaults to ./files "encryptionKey": "someKey" //optional, but mandatory if you want to encrypt files } } @@ -37,7 +37,7 @@ When using parse-server-fs-adapter across multiple parse-server instances it's i var FSFilesAdapter = require('@parse/fs-files-adapter'); var fsAdapter = new FSFilesAdapter({ - "filesSubDirectory": "my/files/folder", // optional + "filesSubDirectory": "my/files/folder", // optional, defaults to ./files "encryptionKey": "someKey" //optional, but mandatory if you want to encrypt files }); @@ -56,7 +56,7 @@ Periodically you may want to rotate your encryptionKey for security reasons. Whe var FSFilesAdapter = require('@parse/fs-files-adapter'); var fsAdapter = new FSFilesAdapter({ - "filesSubDirectory": "my/files/folder", // optional + "filesSubDirectory": "my/files/folder", // optional, defaults to ./files "encryptionKey": "newKey" //Use the newKey }); diff --git a/spec/secureFiles.spec.js b/spec/secureFiles.spec.js index ec39122..963cf40 100644 --- a/spec/secureFiles.spec.js +++ b/spec/secureFiles.spec.js @@ -19,7 +19,22 @@ describe('File encryption tests', () => { }) }); - it("should save encrypted file", async function(done) { + it("should save encrypted file in default directory", async function(done) { + var adapter = new FileSystemAdapter({ + encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' + }); + var filename = 'file2.txt'; + const filePath = 'files/'+filename; + await adapter.createFile(filename, "hello world", 'text/utf8'); + const result = await adapter.getFileData(filename); + expect(result instanceof Buffer).toBe(true); + expect(result.toString('utf-8')).toEqual("hello world"); + const data = fs.readFileSync(filePath); + expect(data.toString('utf-8')).not.toEqual("hello world"); + done() + }, 5000); + + it("should save encrypted file in specified directory", async function(done) { var adapter = new FileSystemAdapter({ filesSubDirectory: directory, encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' diff --git a/spec/test.spec.js b/spec/test.spec.js index a7112cd..62d1bd7 100644 --- a/spec/test.spec.js +++ b/spec/test.spec.js @@ -10,3 +10,9 @@ describe('FileSystemAdapter tests', () => { filesAdapterTests.testAdapter("FileSystemAdapter", fsAdapter); }) + +describe('FileSystemAdapter tests - no options', () => { + var fsAdapter = new FileSystemAdapter(); + + filesAdapterTests.testAdapter("FileSystemAdapter", fsAdapter); +}) From cde0fa785b71aa90c4a78c081c3ddd720e1ab250 Mon Sep 17 00:00:00 2001 From: Corey's iMac Date: Sun, 25 Oct 2020 11:38:27 -0400 Subject: [PATCH 4/7] add Dangefile to see if it reduces error --- Dangerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Dangerfile diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..d7c5568 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,7 @@ +has_app_changes = !git.modified_files.grep(/lib/).empty? +has_test_changes = !git.modified_files.grep(/spec/).empty? + +# Non-trivial amounts of app changes without tests +if git.lines_of_code > 50 && has_app_changes && !has_test_changes + warn "This PR may need tests." +end From e150a7ebfcfb8ddce427e992467063fc91da9d88 Mon Sep 17 00:00:00 2001 From: Corey's iMac Date: Sun, 25 Oct 2020 11:43:09 -0400 Subject: [PATCH 5/7] remove Dangerfile --- Dangerfile | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Dangerfile diff --git a/Dangerfile b/Dangerfile deleted file mode 100644 index d7c5568..0000000 --- a/Dangerfile +++ /dev/null @@ -1,7 +0,0 @@ -has_app_changes = !git.modified_files.grep(/lib/).empty? -has_test_changes = !git.modified_files.grep(/spec/).empty? - -# Non-trivial amounts of app changes without tests -if git.lines_of_code > 50 && has_app_changes && !has_test_changes - warn "This PR may need tests." -end From b7b23b2f620cb2fc9ee9b9631aee383bda5483cb Mon Sep 17 00:00:00 2001 From: Corey's iMac Date: Sun, 25 Oct 2020 12:04:44 -0400 Subject: [PATCH 6/7] add getFileLocation test --- spec/secureFiles.spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/secureFiles.spec.js b/spec/secureFiles.spec.js index 963cf40..4ba4761 100644 --- a/spec/secureFiles.spec.js +++ b/spec/secureFiles.spec.js @@ -19,6 +19,14 @@ describe('File encryption tests', () => { }) }); + it('should create file location based on config', async function(done) { + var fsAdapter = new FileSystemAdapter(); + var config = {mount: "/parse", applicationId: "yolo"} + let location = fsAdapter.getFileLocation(config, "hello.txt") + expect(location).toBe("/parse/files/yolo/hello.txt"); + done() + }, 5000) + it("should save encrypted file in default directory", async function(done) { var adapter = new FileSystemAdapter({ encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' From a65d5b5be22ad5b424ca8a9187d17e932caa31a5 Mon Sep 17 00:00:00 2001 From: Corey's iMac Date: Sun, 25 Oct 2020 12:13:31 -0400 Subject: [PATCH 7/7] add missing testcase --- spec/secureFiles.spec.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/spec/secureFiles.spec.js b/spec/secureFiles.spec.js index 4ba4761..4123401 100644 --- a/spec/secureFiles.spec.js +++ b/spec/secureFiles.spec.js @@ -21,9 +21,9 @@ describe('File encryption tests', () => { it('should create file location based on config', async function(done) { var fsAdapter = new FileSystemAdapter(); - var config = {mount: "/parse", applicationId: "yolo"} - let location = fsAdapter.getFileLocation(config, "hello.txt") - expect(location).toBe("/parse/files/yolo/hello.txt"); + var config = {mount: '/parse', applicationId: 'yolo'} + let location = fsAdapter.getFileLocation(config, 'hello.txt') + expect(location).toBe('/parse/files/yolo/hello.txt'); done() }, 5000) @@ -58,6 +58,22 @@ describe('File encryption tests', () => { done() }, 5000); + it("should save encrypted file in specified directory when directory starts with /", async function(done) { + var adapter = new FileSystemAdapter({ + filesSubDirectory: '/sub1/sub2', + encryptionKey: '89E4AFF1-DFE4-4603-9574-BFA16BB446FD' + }); + var filename = 'file2.txt'; + const filePath = 'files/'+directory+'/'+filename; + await adapter.createFile(filename, "hello world", 'text/utf8'); + const result = await adapter.getFileData(filename); + expect(result instanceof Buffer).toBe(true); + expect(result.toString('utf-8')).toEqual("hello world"); + const data = fs.readFileSync(filePath); + expect(data.toString('utf-8')).not.toEqual("hello world"); + done() + }, 5000); + it("should rotate key of all unencrypted files to encrypted files", async function(done) { const unEncryptedAdapter = new FileSystemAdapter({ filesSubDirectory: directory