(options)
| 277 | } |
| 278 | |
| 279 | export(options) { |
| 280 | switch (options?.format) { |
| 281 | case 'jwk': |
| 282 | return getKeyObjectHandle(this).exportJwk({}, false); |
| 283 | case 'raw-public': { |
| 284 | const handle = getKeyObjectHandle(this); |
| 285 | const asymmetricKeyType = getKeyObjectAsymmetricKeyType(this); |
| 286 | if (asymmetricKeyType === 'ec') { |
| 287 | const { type = 'uncompressed' } = options; |
| 288 | validateOneOf(type, 'options.type', ['compressed', 'uncompressed']); |
| 289 | const form = type === 'compressed' ? |
| 290 | POINT_CONVERSION_COMPRESSED : POINT_CONVERSION_UNCOMPRESSED; |
| 291 | return handle.exportECPublicRaw(form); |
| 292 | } |
| 293 | return handle.rawPublicKey(); |
| 294 | } |
| 295 | default: { |
| 296 | const asymmetricKeyType = getKeyObjectAsymmetricKeyType(this); |
| 297 | const handle = getKeyObjectHandle(this); |
| 298 | const { |
| 299 | format, |
| 300 | type, |
| 301 | } = parsePublicKeyEncoding(options, asymmetricKeyType); |
| 302 | return handle.export(format, type); |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | class PrivateKeyObject extends AsymmetricKeyObject { |
nothing calls this directly
no test coverage detected