Skip to content

crypto-updates - #533

Merged
mohitpubnub merged 22 commits into
masterfrom
CLEN-3833-remove-cryptojs
Nov 17, 2026
Merged

mohitpubnub merged 22 commits into
masterfrom
CLEN-3833-remove-cryptojs

Conversation

@mohitpubnub

@mohitpubnub mohitpubnub commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

refactor(crypto-library): Remove bundled CryptoJS.

Replaced the bundled CryptoJS with native crypto on web, Node.js and noble on React Native.

BREAKING CHANGES: Web: encrypt()/decrypt() now return Promises, and encryption needs crypto.subtle (HTTPS or localhost). Runtimes without it, such as tvOS TVMLKit, can no longer encrypt or decrypt.
React Native: encrypt()/decrypt() now return Promises. Apps using cipherKey must install @noble/ciphers, @noble/hashes and react-native-get-random-values.

feat: support for aes gcm type decryption

add support for aes gcm type decryption by adding cryptor with decryption capability.

build(dependency): bump undici minor version

undici minor version bump

…or encrypt and decrypt to be MaybePromise because a custom cryptor can still be syncronous as per user wish,

updates publish, subscribe, fetchMessages, history apis to handle encryption,decryption with async methods with the help of prepare and promise.all.
added utility bytes.ts for one common place for required bytes operation across the apis.
updated node crypto module to use its prmitive and same for the web cryptomodule for crypto.subtle use.
noble for react native platform, added as optional peer dependency.
@pubnub-snyk-universal-prd

pubnub-snyk-universal-prd Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mohitpubnub mohitpubnub added priority: medium This PR should be reviewed after all high priority PRs. type: feature This PR contains new feature. labels Nov 4, 2026

@parfeon parfeon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM

Few clarification requests has been left.

Comment thread src/core/pubnub-common.ts
if (preparation) {
// Requests which require preparation are scheduled in call order (same as synchronous requests).
const orderedPreparation = this.requestsPreparation.then(() => preparation);
this.requestsPreparation = orderedPreparation.catch(() => {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why we silence crypto errors?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty .catch(() => {}) does not hide crypto errors. It only resets the preparation-queue tail so one failed prepare() does not reject every later encrypted request.
This call still awaits orderedPreparation, and that rejection goes to handleRequestError

Comment thread tsconfig.rollup.json Resolved
@parfeon
parfeon self-requested a review November 17, 2026 10:28

@parfeon parfeon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mohitpubnub

Copy link
Copy Markdown
Contributor Author

@pubnub-release-bot release

@mohitpubnub
mohitpubnub merged commit 3f80eab into master Nov 17, 2026
11 of 13 checks passed
@mohitpubnub
mohitpubnub deleted the CLEN-3833-remove-cryptojs branch November 17, 2026 11:44
@pubnub-release-bot

Copy link
Copy Markdown
Contributor

🚀 Release successfully completed 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: medium This PR should be reviewed after all high priority PRs. type: feature This PR contains new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants