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

Function exportKeyRawPublic

lib/internal/crypto/webcrypto.js:507–550  ·  view source on GitHub ↗
(key, format)

Source from the content-addressed store, hash-verified

505}
506
507function exportKeyRawPublic(key, format) {
508 switch (getCryptoKeyAlgorithm(key).name) {
509 case 'ECDSA':
510 // Fall through
511 case 'ECDH':
512 return require('internal/crypto/ec')
513 .ecExportKey(key, kWebCryptoKeyFormatRaw);
514 case 'Ed25519':
515 // Fall through
516 case 'Ed448':
517 // Fall through
518 case 'X25519':
519 // Fall through
520 case 'X448':
521 return require('internal/crypto/cfrg')
522 .cfrgExportKey(key, kWebCryptoKeyFormatRaw);
523 case 'ML-DSA-44':
524 // Fall through
525 case 'ML-DSA-65':
526 // Fall through
527 case 'ML-DSA-87': {
528 // ML-DSA keys don't recognize "raw"
529 if (format !== 'raw-public') {
530 return undefined;
531 }
532 return require('internal/crypto/ml_dsa')
533 .mlDsaExportKey(key, kWebCryptoKeyFormatRaw);
534 }
535 case 'ML-KEM-512':
536 // Fall through
537 case 'ML-KEM-768':
538 // Fall through
539 case 'ML-KEM-1024': {
540 // ML-KEM keys don't recognize "raw"
541 if (format !== 'raw-public') {
542 return undefined;
543 }
544 return require('internal/crypto/ml_kem')
545 .mlKemExportKey(key, kWebCryptoKeyFormatRaw);
546 }
547 default:
548 return undefined;
549 }
550}
551
552function exportKeyRawSeed(key) {
553 switch (getCryptoKeyAlgorithm(key).name) {

Callers 1

exportKeySyncFunction · 0.85

Calls 2

getCryptoKeyAlgorithmFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…