MCPcopy Index your code
hub / github.com/nodejs/node / generateKeyJob

Function generateKeyJob

lib/internal/crypto/keygen.js:386–405  ·  view source on GitHub ↗
(mode, keyType, options)

Source from the content-addressed store, hash-verified

384// Symmetric Key Generation
385
386function generateKeyJob(mode, keyType, options) {
387 validateString(keyType, 'type');
388 validateObject(options, 'options');
389 const { length } = options;
390 switch (keyType) {
391 case 'hmac':
392 validateInteger(length, 'options.length', 8, 2 ** 31 - 1);
393 break;
394 case 'aes':
395 validateOneOf(length, 'options.length', [128, 192, 256]);
396 break;
397 default:
398 throw new ERR_INVALID_ARG_VALUE(
399 'type',
400 keyType,
401 'must be a supported key type');
402 }
403
404 return new SecretKeyGenJob(mode, length);
405}
406
407function handleGenerateKeyError(ret) {
408 if (ret === undefined)

Callers 2

generateKeyFunction · 0.85
generateKeySyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…