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

Function generateKey

lib/internal/crypto/keygen.js:418–434  ·  view source on GitHub ↗
(type, options, callback)

Source from the content-addressed store, hash-verified

416}
417
418function generateKey(type, options, callback) {
419 if (typeof options === 'function') {
420 callback = options;
421 options = undefined;
422 }
423
424 validateFunction(callback, 'callback');
425
426 const job = generateKeyJob(kCryptoJobAsync, type, options);
427
428 job.ondone = (error, key) => {
429 if (error) return FunctionPrototypeCall(callback, job, error);
430 FunctionPrototypeCall(callback, job, null, wrapKey(key, SecretKeyObject));
431 };
432
433 handleGenerateKeyError(job.run());
434}
435
436function generateKeySync(type, options) {
437 return handleGenerateKeyError(

Callers 1

Calls 4

generateKeyJobFunction · 0.85
handleGenerateKeyErrorFunction · 0.85
wrapKeyFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…