Skip to content

Commit

Permalink
refactor: generate_key_pair type returns KeyLike
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jan 22, 2021
1 parent c068e46 commit 9998cb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/functions/_util_generate_key_pair_.generatekeypair.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Function: generateKeyPair

**generateKeyPair**(`alg`: string, `options?`: [GenerateKeyPairOptions](../interfaces/_util_generate_key_pair_.generatekeypairoptions.md)): Promise<{ privateKey: CryptoKey \| KeyObject ; publicKey: CryptoKey \| KeyObject }\>
**generateKeyPair**(`alg`: string, `options?`: [GenerateKeyPairOptions](../interfaces/_util_generate_key_pair_.generatekeypairoptions.md)): Promise<{ privateKey: [KeyLike](../types/_types_d_.keylike.md) ; publicKey: [KeyLike](../types/_types_d_.keylike.md) }\>

*Defined in [src/util/generate_key_pair.ts:47](https://github.com/panva/jose/blob/v3.5.3/src/util/generate_key_pair.ts#L47)*

Expand Down Expand Up @@ -35,4 +35,4 @@ Name | Type | Description |
`alg` | string | JWA Algorithm Identifier to be used with the generated key pair. |
`options?` | [GenerateKeyPairOptions](../interfaces/_util_generate_key_pair_.generatekeypairoptions.md) | Additional options passed down to the key pair generation. |

**Returns:** Promise<{ privateKey: CryptoKey \| KeyObject ; publicKey: CryptoKey \| KeyObject }\>
**Returns:** Promise<{ privateKey: [KeyLike](../types/_types_d_.keylike.md) ; publicKey: [KeyLike](../types/_types_d_.keylike.md) }\>
4 changes: 2 additions & 2 deletions src/util/generate_key_pair.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { KeyObject } from 'crypto'
import { generateKeyPair as generate } from '../runtime/generate.js'
import type { KeyLike } from '../types.js'

export interface GenerateKeyPairOptions {
/**
Expand Down Expand Up @@ -47,6 +47,6 @@ export interface GenerateKeyPairOptions {
export default async function generateKeyPair(
alg: string,
options?: GenerateKeyPairOptions,
): Promise<{ privateKey: CryptoKey | KeyObject; publicKey: CryptoKey | KeyObject }> {
): Promise<{ privateKey: KeyLike; publicKey: KeyLike }> {
return generate(alg, options)
}

0 comments on commit 9998cb3

Please sign in to comment.