You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces a new feature to include system metadata assertions during the encryption process in the `tdf3` library. The changes add support for automatically generating and embedding metadata about the system environment into the manifest of encrypted files. This functionality is configurable and has been thoroughly tested with new unit tests.
### Feature: System Metadata Assertions
#### Core Implementation:
* **`lib/tdf3/src/assertions.ts`**: Added the `SystemMetadata` type to define the structure of system metadata, and implemented the `getSystemMetadataAssertionConfig` function to generate default metadata assertions. This includes details such as TDF specification version, SDK version, operating system, and browser user agent.
* **`lib/tdf3/src/tdf.ts`**: Modified the `writeStream` function to include system metadata assertions in the manifest if the `systemMetadataAssertion` flag is enabled in the encryption configuration.
#### Configuration Enhancements:
* **`lib/tdf3/src/client/builders.ts`**: Added the `systemMetadataAssertion` property to `EncryptParams` and a corresponding `withSystemMetadataAssertion` method in `EncryptParamsBuilder` for enabling this feature during encryption. [[1]](diffhunk://#diff-fa045a0a354fbc54f8447bbc5aeb39723e58b98150e278dc5584ee9309fdce6bR53) [[2]](diffhunk://#diff-fa045a0a354fbc54f8447bbc5aeb39723e58b98150e278dc5584ee9309fdce6bR503-R515)
* **`lib/tdf3/src/tdf.ts`**: Updated the `EncryptConfiguration` type to include the `systemMetadataAssertion` flag.
#### Client Integration:
* **`lib/tdf3/src/client/index.ts`**: Passed the `systemMetadataAssertion` flag to the encryption configuration within the `Client` class.
### Testing: Unit Tests for System Metadata Assertions
* **`lib/tests/mocha/encrypt-decrypt.spec.ts`**: Added a new test case to verify the inclusion and correctness of system metadata assertions in the manifest during encryption and decryption processes. This ensures that the metadata is correctly generated, embedded, and validated.
These changes enhance the encryption process by providing additional metadata for debugging, auditing, or compliance purposes, while maintaining flexibility through optional configuration.
0 commit comments