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

Function mlDsaGenerateKey

lib/internal/crypto/ml_dsa.js:57–79  ·  view source on GitHub ↗
(algorithm, extractable, usages)

Source from the content-addressed store, hash-verified

55const kUsages = createKeyUsages(['verify'], ['sign']);
56
57function mlDsaGenerateKey(algorithm, extractable, usages) {
58 const { name } = algorithm;
59 const usagesSet = validateKeyUsages(usages, kUsages.keygen, name);
60
61 const nid = {
62 '__proto__': null,
63 'ML-DSA-44': EVP_PKEY_ML_DSA_44,
64 'ML-DSA-65': EVP_PKEY_ML_DSA_65,
65 'ML-DSA-87': EVP_PKEY_ML_DSA_87,
66 }[name];
67
68 const keyAlgorithm = { name };
69 const keyUsages = getKeyPairUsages(usagesSet, kUsages);
70 validateUsagesNotEmpty(keyUsages.private);
71
72 return jobPromise(() => new NidKeyPairGenJob(
73 kCryptoJobWebCrypto,
74 nid,
75 keyAlgorithm,
76 getUsagesMask(keyUsages.public),
77 getUsagesMask(keyUsages.private),
78 extractable));
79}
80
81function mlDsaExportKey(key, format) {
82 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…