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

Function cfrgGenerateKey

lib/internal/crypto/cfrg.js:66–89  ·  view source on GitHub ↗
(algorithm, extractable, usages)

Source from the content-addressed store, hash-verified

64};
65
66function cfrgGenerateKey(algorithm, extractable, usages) {
67 const { name } = algorithm;
68 const allowedUsages = kUsages[name];
69 const usagesSet = validateKeyUsages(usages, allowedUsages.keygen, name);
70 const nid = {
71 '__proto__': null,
72 'Ed25519': EVP_PKEY_ED25519,
73 'Ed448': EVP_PKEY_ED448,
74 'X25519': EVP_PKEY_X25519,
75 'X448': EVP_PKEY_X448,
76 }[name];
77
78 const keyAlgorithm = { name };
79 const keyUsages = getKeyPairUsages(usagesSet, allowedUsages);
80 validateUsagesNotEmpty(keyUsages.private);
81
82 return jobPromise(() => new NidKeyPairGenJob(
83 kCryptoJobWebCrypto,
84 nid,
85 keyAlgorithm,
86 getUsagesMask(keyUsages.public),
87 getUsagesMask(keyUsages.private),
88 extractable));
89}
90
91function cfrgExportKey(key, format) {
92 try {

Callers

nothing calls this directly

Calls 5

validateKeyUsagesFunction · 0.85
getKeyPairUsagesFunction · 0.85
validateUsagesNotEmptyFunction · 0.85
jobPromiseFunction · 0.85
getUsagesMaskFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…