(type, ctx, key)
| 512 | } |
| 513 | |
| 514 | function validateAsymmetricKeyType(type, ctx, key) { |
| 515 | if (ctx === kCreatePrivate) { |
| 516 | throw new ERR_INVALID_ARG_TYPE( |
| 517 | 'key', |
| 518 | ['string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'], |
| 519 | key, |
| 520 | ); |
| 521 | } |
| 522 | |
| 523 | if (type !== 'private') { |
| 524 | if (ctx === kConsumePrivate || ctx === kCreatePublic) |
| 525 | throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(type, 'private'); |
| 526 | if (type !== 'public') { |
| 527 | throw new ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE(type, |
| 528 | 'private or public'); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | function getKeyTypes(allowKeyObject, bufferOnly = false) { |
| 534 | const types = [ |
no outgoing calls
no test coverage detected