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

Function parseKeyFormat

lib/internal/crypto/keys.js:350–366  ·  view source on GitHub ↗
(formatStr, defaultFormat, optionName)

Source from the content-addressed store, hash-verified

348});
349
350function parseKeyFormat(formatStr, defaultFormat, optionName) {
351 if (formatStr === undefined && defaultFormat !== undefined)
352 return defaultFormat;
353 else if (formatStr === 'pem')
354 return kKeyFormatPEM;
355 else if (formatStr === 'der')
356 return kKeyFormatDER;
357 else if (formatStr === 'jwk')
358 return kKeyFormatJWK;
359 else if (formatStr === 'raw-public')
360 return kKeyFormatRawPublic;
361 else if (formatStr === 'raw-private')
362 return kKeyFormatRawPrivate;
363 else if (formatStr === 'raw-seed')
364 return kKeyFormatRawSeed;
365 throw new ERR_INVALID_ARG_VALUE(optionName, formatStr);
366}
367
368function parseKeyType(typeStr, required, keyType, isPublic, optionName) {
369 if (typeStr === undefined && !required) {

Callers 2

parseKeyFormatAndTypeFunction · 0.85
prepareAsymmetricKeyFunction · 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…