Skip to content

Conversation

@shibd
Copy link
Member

@shibd shibd commented Dec 17, 2025

Motivation

Support end to end encryption/decryption

Modifications

  • Support end to end encryption/decryption
  • Support getEncryptionContext by message

Verifying this change

  • Add a end to end encryption unit test to cover 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)

@shibd shibd changed the title Support end to end encryption Support end to end encryption/decryption Dec 17, 2025
@shibd shibd added this to the 1.16.0 milestone Dec 17, 2025
@shibd shibd self-assigned this Dec 17, 2025
Copy link

Copilot AI left a 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 CryptoKeyReader class that users can extend to provide encryption keys
  • Adds getEncryptionContext() method to Message class to retrieve encryption metadata
  • Supports both encryptionKeys array and cryptoKeyReader configuration 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.

@shibd shibd requested a review from BewareMyPower December 19, 2025 09:49
@shibd shibd requested a review from BewareMyPower December 21, 2025 02:44
@BewareMyPower BewareMyPower merged commit 07e1518 into apache:master Dec 22, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants