-
Notifications
You must be signed in to change notification settings - Fork 95
Support end to end encryption/decryption #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds end-to-end encryption and decryption support to the Pulsar Node.js client. The implementation introduces a CryptoKeyReader abstraction that allows users to provide custom encryption key management logic through JavaScript, which is then bridged to the underlying Pulsar C++ library.
- Introduces
CryptoKeyReaderclass that users can extend to provide encryption keys - Adds
getEncryptionContext()method to Message class to retrieve encryption metadata - Supports both
encryptionKeysarray andcryptoKeyReaderconfiguration for producers and consumers
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/encryption.test.js | New test file with two test cases covering successful encryption/decryption and decryption failure scenarios |
| src/addon.cc | Registers the new CryptoKeyReader class in the Node.js addon exports |
| src/ProducerConfig.cc | Adds support for encryptionKeys array and cryptoKeyReader configuration options for producers |
| src/Message.h | Declares the new GetEncryptionContext method |
| src/Message.cc | Implements GetEncryptionContext by accessing internal message structure and extracting encryption metadata including keys, algorithm, compression info, and decryption status |
| src/CryptoKeyReader.h | Header file defining the CryptoKeyReader wrapper class interface |
| src/CryptoKeyReader.cc | Implements CryptoKeyReaderWrapper that bridges JavaScript key reader implementations to C++ through thread-safe callbacks |
| src/ConsumerConfig.cc | Adds cryptoKeyReader configuration support for consumers |
| index.js | Exports the CryptoKeyReader class |
| index.d.ts | Adds TypeScript type definitions for CryptoKeyReader, EncryptionKeyInfo, EncryptionContext, and EncryptionKey interfaces |
| binding.gyp | Includes CryptoKeyReader.cc in the build configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Support end to end encryption/decryption
Modifications
Verifying this change
Documentation
doc-required(Your PR needs to update docs and you will update later)
doc-not-needed(Please explain why)
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)