-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
Use Case
As a driver engineer,
I want the FLE bindings logic to live in the driver and be tested,
So that we can be confident of any refactors we make to the code.
User Impact
(see parent ticket)
Dependencies
- done concurrently with
NODE-5420
Unknowns
- questions that need to be answered to determine implementation
Acceptance Criteria
Implementation Requirements
- Move the bindings logic from the `encryption` folder into `src/client-side-encryption`. Leave the files as Javascript files and ignore lint warnings (using .eslintignore)
- enable the `allowJS` flag, to be disabled in https://jira.mongodb.org/browse/NODE-5422.
- Necessary changes to FLE logic
- Refactor the state machine, auto encrypter and client encrypter to be top-level modules that export classes instead of modules that export factory functions
- Adjust the state machine, auto encrypter and client encryption to import bson from the driver, instead of relying on the injected BSON lib. Remove the _bson properties from each class as well (breaking, discussed and approved)
- changes to driver tests
- The `ClientEncryption` filter will still check that `mongodb-client-encryption` can be imported.
- Any references to FLE classes will be imported directly from the driver instead of importing from `this.configuration.mongodbClientEncryption.<className>`
- Adjust the UTR to import `ClientEncryption` directly from the driver.
- other
- consolidate FLE import logic into a function that lazy-loads mongodb-client-encryption in deps.ts
- Consume the lazy-import function in class Encrypter and change any references to the auto encrypter to import from the driver instead of mongodb-client-encryption
- Add @aws-sdk/credential-providers (already a driver peer dep) and gcp-metadata as optional peer dependencies in the driver. Ensure that these dependencies are lazy loaded.
- FLE unit tests
- Move tests from encrypter/tests into the tests folder. Break apart the tests into any tests that require a live server (integration) and those that do not. Integration tests will go in integration/client-side-encryption and unit tests will go in unit/client-side-encryption/<file name corresponding to source file name>.
- After releasing an alpha of mongodb-client-encryption with changes from
NODE-5420, adjust CI installation scripts to install the alpha - Adjust the custom-dependency-tests to run all FLE tests (in the driver) against `master` and the pinned commit of libmongocrypt. Bump the pinned commit to the same commit as the release of the mongodb-client-encryption alpha.
Testing Requirements
- no new tests
- existing FLE tests in the driver must pass
- existing libmongocrypt tests must pass in the driver
- CI should be green with these changes
Documentation Requirements
- no docs requirements for this subtask
Follow Up Requirements
- n/a