Skip to content

🐛 fix: native bridge buffer range#10

Open
tp26610 wants to merge 8 commits intocbx-v1.xfrom
fix/native-bridge-buffer-range
Open

🐛 fix: native bridge buffer range#10
tp26610 wants to merge 8 commits intocbx-v1.xfrom
fix/native-bridge-buffer-range

Conversation

@tp26610
Copy link
Copy Markdown
Collaborator

@tp26610 tp26610 commented Mar 31, 2026

PR Summary by Typo

Overview

This PR addresses a bug where Buffer objects with a non-zero byteOffset were not correctly handled when passed to native bridge functions, leading to incorrect cryptographic computations. The fix involves introducing a utility to ensure proper ArrayBuffer conversion for all Buffer instances.

Key Changes

  • Introduced a new toArrayBuffer utility function to correctly convert Buffer objects, especially those with a byteOffset, into ArrayBuffer for native calls.
  • Updated DiffieHellman and ECDH classes to use toArrayBuffer for all native bridge interactions involving buffers (e.g., init, computeSecret, setPublicKey, setPrivateKey).
  • Added a new test case to ecdh_tests.ts to specifically verify that computeSecret works as expected when provided with a sliced public key buffer.

Work Breakdown

Category Lines Changed
New Work 40 (72.7%)
Churn 7 (12.7%)
Rework 8 (14.5%)
Total Changes 55
To turn off PR summary, please visit Notification settings.

@tp26610 tp26610 changed the base branch from cbx to main March 31, 2026 04:29
@tp26610 tp26610 force-pushed the fix/native-bridge-buffer-range branch from c47eaa8 to 2300f31 Compare March 31, 2026 04:37
@tp26610 tp26610 changed the title fix/native bridge buffer range 🐛 fix: native bridge buffer range Apr 1, 2026
@tp26610 tp26610 changed the base branch from main to cbx-v1.x April 1, 2026 11:12
@tp26610 tp26610 marked this pull request as ready for review April 1, 2026 11:12
@tp26610 tp26610 enabled auto-merge April 1, 2026 11:12
@typo-app
Copy link
Copy Markdown

typo-app bot commented Apr 1, 2026

Static Code Review 📊

✅ All quality checks passed!

Copy link
Copy Markdown

@typo-app typo-app bot left a comment

Choose a reason for hiding this comment

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

AI Code Review 🤖

Files Reviewed: 3
Comments Added: 0
Lines of Code Analyzed: 63
Critical Issues: 0

PR Health: Excellent 🔥

Give 👍 or 👎 on each review comment to help us improve.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant