crypto: align verifyOneShot accepted types · nodejs/node@16d2fd3 · GitHub
Skip to content

Commit 16d2fd3

Browse files
Anshikakalpanaaduh95
authored andcommitted
crypto: align verifyOneShot accepted types
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com> PR-URL: #63280 Fixes: #62903 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 02f73c7 commit 16d2fd3

3 files changed

Lines changed: 42 additions & 20 deletions

File tree

doc/api/crypto.md

Lines changed: 3 additions & 3 deletions

lib/internal/crypto/sig.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,6 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
257257

258258
data = getArrayBufferOrView(data, 'data');
259259

260-
if (!isArrayBufferView(data)) {
261-
throw new ERR_INVALID_ARG_TYPE(
262-
'data',
263-
['Buffer', 'TypedArray', 'DataView'],
264-
data,
265-
);
266-
}
267-
268260
// Options specific to RSA
269261
const rsaPadding = getPadding(key);
270262
const pssSaltLength = getSaltLength(key);
@@ -275,13 +267,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
275267
// Options specific to Ed448 and ML-DSA
276268
const context = getContext(key);
277269

278-
if (!isArrayBufferView(signature)) {
279-
throw new ERR_INVALID_ARG_TYPE(
280-
'signature',
281-
['Buffer', 'TypedArray', 'DataView'],
282-
signature,
283-
);
284-
}
270+
signature = getArrayBufferOrView(signature, 'signature');
285271

286272
const {
287273
data: keyData,

test/parallel/test-crypto-sign-verify.js

Lines changed: 38 additions & 2 deletions

0 commit comments

Comments
 (0)