Skip to content

chore: Optimize key exports 🚀#38492

Open
sanjaiyan-dev wants to merge 4 commits into
RocketChat:developfrom
sanjaiyan-dev:sanjaiyan-jwt-optimize
Open

chore: Optimize key exports 🚀#38492
sanjaiyan-dev wants to merge 4 commits into
RocketChat:developfrom
sanjaiyan-dev:sanjaiyan-jwt-optimize

Conversation

@sanjaiyan-dev
Copy link
Copy Markdown

@sanjaiyan-dev sanjaiyan-dev commented Feb 4, 2026

This PR optimizes the key generation flow by parallelizing independent crypto operations.

Performance: Refactored exportSPKI and exportPKCS8 to run concurrently using Promise.all. This removes the "waterfall" delay and leverages background threads for faster key processing.

Summary by CodeRabbit

  • Chores
    • Parallelized independent crypto operations during JWT key generation to improve performance and reduce latency.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Feb 4, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: ea6dccf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/jwt Minor
@rocket.chat/meteor Patch
@rocket.chat/license Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 4, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 4, 2026

Walkthrough

The getPairs function in packages/jwt/src/index.ts now runs exportSPKI(publicKey) and exportPKCS8(privateKey) in parallel using Promise.all, preserving behavior while reducing total latency. A changeset bump for the package was added.

Changes

Cohort / File(s) Summary
Key Export Parallelization
packages/jwt/src/index.ts
Refactored getPairs to execute exportSPKI(publicKey) and exportPKCS8(privateKey) concurrently via Promise.all with array destructuring, maintaining the same API and error handling.
Release Metadata
.changeset/dry-cities-own.md
Added changeset entry bumping the package version and describing the optimization (parallelized crypto exports).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Two keys once queued in careful line,
Now leap together, bright and fine.
Promises join in parallel play,
Faster exports hop away! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references optimizing key exports, which directly aligns with the main change: parallelizing getPairs' export operations for improved performance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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