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

Function exportKeyRawSecret

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

Source from the content-addressed store, hash-verified

571}
572
573function exportKeyRawSecret(key, format) {
574 switch (getCryptoKeyAlgorithm(key).name) {
575 case 'AES-CTR':
576 // Fall through
577 case 'AES-CBC':
578 // Fall through
579 case 'AES-GCM':
580 // Fall through
581 case 'AES-KW':
582 // Fall through
583 case 'HMAC':
584 return TypedArrayPrototypeGetBuffer(getCryptoKeyHandle(key).export());
585 case 'AES-OCB':
586 // Fall through
587 case 'KMAC128':
588 // Fall through
589 case 'KMAC256':
590 // Fall through
591 case 'ChaCha20-Poly1305':
592 if (format === 'raw-secret') {
593 return TypedArrayPrototypeGetBuffer(getCryptoKeyHandle(key).export());
594 }
595 return undefined;
596 default:
597 return undefined;
598 }
599}
600
601function exportKeyJWK(key) {
602 const algorithm = getCryptoKeyAlgorithm(key);

Callers 1

exportKeySyncFunction · 0.85

Calls 3

getCryptoKeyAlgorithmFunction · 0.85
getCryptoKeyHandleFunction · 0.85
exportMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…