(key, format)
| 571 | } |
| 572 | |
| 573 | function 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 | |
| 601 | function exportKeyJWK(key) { |
| 602 | const algorithm = getCryptoKeyAlgorithm(key); |
no test coverage detected
searching dependent graphs…