(algorithm, data, key, signature, callback)
| 257 | }; |
| 258 | |
| 259 | function verifyOneShot(algorithm, data, key, signature, callback) { |
| 260 | if (algorithm != null) |
| 261 | validateString(algorithm, 'algorithm'); |
| 262 | |
| 263 | if (callback !== undefined) |
| 264 | validateFunction(callback, 'callback'); |
| 265 | |
| 266 | data = getArrayBufferOrView(data, 'data'); |
| 267 | |
| 268 | // Options specific to RSA |
| 269 | const rsaPadding = getPadding(key); |
| 270 | const pssSaltLength = getSaltLength(key); |
| 271 | |
| 272 | // Options specific to (EC)DSA |
| 273 | const dsaSigEnc = getDSASignatureEncoding(key); |
| 274 | |
| 275 | // Options specific to Ed448 and ML-DSA |
| 276 | const context = getContext(key); |
| 277 | |
| 278 | signature = getArrayBufferOrView(signature, 'signature'); |
| 279 | |
| 280 | const { |
| 281 | data: keyData, |
| 282 | format: keyFormat, |
| 283 | type: keyType, |
| 284 | passphrase: keyPassphrase, |
| 285 | namedCurve: keyNamedCurve, |
| 286 | } = preparePublicOrPrivateKey(key); |
| 287 | |
| 288 | const job = new SignJob( |
| 289 | callback ? kCryptoJobAsync : kCryptoJobSync, |
| 290 | kSignJobModeVerify, |
| 291 | keyData, |
| 292 | keyFormat, |
| 293 | keyType, |
| 294 | keyPassphrase, |
| 295 | keyNamedCurve, |
| 296 | data, |
| 297 | algorithm, |
| 298 | pssSaltLength, |
| 299 | rsaPadding, |
| 300 | dsaSigEnc, |
| 301 | context, |
| 302 | signature); |
| 303 | |
| 304 | if (!callback) { |
| 305 | const { 0: err, 1: result } = job.run(); |
| 306 | if (err !== undefined) |
| 307 | throw err; |
| 308 | |
| 309 | return result; |
| 310 | } |
| 311 | |
| 312 | job.ondone = (error, result) => { |
| 313 | if (error) return FunctionPrototypeCall(callback, job, error); |
| 314 | FunctionPrototypeCall(callback, job, null, result); |
| 315 | }; |
| 316 | job.run(); |
nothing calls this directly
no test coverage detected