Skip to content

crypto: align verifyOneShot accepted types#63280

Open
Anshikakalpana wants to merge 1 commit into
nodejs:mainfrom
Anshikakalpana:crypto-verify-types-fix
Open

crypto: align verifyOneShot accepted types#63280
Anshikakalpana wants to merge 1 commit into
nodejs:mainfrom
Anshikakalpana:crypto-verify-types-fix

Conversation

@Anshikakalpana
Copy link
Copy Markdown
Contributor

Align crypto.verify() accepted types with crypto.sign()

crypto.sign() accepts ArrayBuffer and SharedArrayBuffer for data, but crypto.verify() rejected them with ERR_INVALID_ARG_TYPE. Two issues in verifyOneShot():

  1. A redundant isArrayBufferView(data) check after getArrayBufferOrView() was incorrectly rejecting ArrayBuffer and SharedArrayBuffer — getArrayBufferOrView() already handles validation and normalization.

  2. signature had only an isArrayBufferView() check with no prior getArrayBufferOrView() call, so ArrayBuffer and SharedArrayBuffer were rejected there too.

Fix both by aligning verifyOneShot() with the signOneShot() pattern. Update docs and add test coverage for the affected types.

Fixes: #62903
Closes: #63268

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels May 13, 2026
@Anshikakalpana Anshikakalpana force-pushed the crypto-verify-types-fix branch from 4e06ba8 to 994a54a Compare May 13, 2026 08:43
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
@Anshikakalpana Anshikakalpana force-pushed the crypto-verify-types-fix branch from 994a54a to 08427d7 Compare May 13, 2026 09:18
@panva panva added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 13, 2026
@panva panva added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels May 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 13, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (c363bec) to head (08427d7).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63280      +/-   ##
==========================================
+ Coverage   90.03%   90.05%   +0.01%     
==========================================
  Files         714      714              
  Lines      225242   225228      -14     
  Branches    42579    42569      -10     
==========================================
+ Hits       202804   202820      +16     
+ Misses      14238    14174      -64     
- Partials     8200     8234      +34     
Files with missing lines Coverage Δ
lib/internal/crypto/sig.js 98.45% <100.00%> (+2.00%) ⬆️

... and 45 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crypto.verify accepted types mismatch documentation (and crypto.sign)

3 participants