Add file bucket encryption using fileKey (#6765)

* add fileKey encryption to GridFSBucketStorageAdapter

* remove fileAdapter options from test spec

* ensure promise doesn't fall through in getFileData

* switch secretKey to fileKey
This commit is contained in:
Corey
2020-07-01 19:43:26 -04:00
committed by GitHub
parent d5ac0f7748
commit 5426f5a4f7
3 changed files with 65 additions and 5 deletions

View File

@@ -105,12 +105,13 @@ export function getFilesController(
filesAdapter,
databaseAdapter,
preserveFileName,
fileKey,
} = options;
if (!filesAdapter && databaseAdapter) {
throw 'When using an explicit database adapter, you must also use an explicit filesAdapter.';
}
const filesControllerAdapter = loadAdapter(filesAdapter, () => {
return new GridFSBucketAdapter(databaseURI);
return new GridFSBucketAdapter(databaseURI, {}, fileKey);
});
return new FilesController(filesControllerAdapter, appId, {
preserveFileName,