Skip to content

Commit

Permalink
refactor(types): make JWKParameters.kty compatible with @types/node a…
Browse files Browse the repository at this point in the history
…nd @types/web

It is still a required property but this way the interface is compatible
with @types/node crypto.JsonWebKey type and @types/web WebCryptoAPI's
JsonWebKey dictionary
  • Loading branch information
panva committed Feb 23, 2025
1 parent 0c74cb6 commit bb6ccfe
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion docs/types/interfaces/CompactJWEHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ JWE "crit" (Critical) Header Parameter

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
2 changes: 1 addition & 1 deletion docs/types/interfaces/CompactJWSHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ JWS "crit" (Critical) Header Parameter

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
2 changes: 1 addition & 1 deletion docs/types/interfaces/JWEHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ JWE "enc" (Encryption Algorithm) Header Parameter

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ key types are supported.

## Properties

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### alg?

`optional` **alg**: `string`
Expand Down Expand Up @@ -114,6 +106,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### n?

`optional` **n**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWKParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ Generic JSON Web Key Parameters.

## Properties

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### alg?

`optional` **alg**: `string`
Expand Down Expand Up @@ -52,6 +44,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_EC_Private.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ EC JWK "d" (ECC Private Key) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### x

**x**: `string`
Expand Down Expand Up @@ -84,6 +76,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_EC_Public.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ EC JWK "crv" (Curve) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### x

**x**: `string`
Expand Down Expand Up @@ -76,6 +68,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_OKP_Private.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ OKP JWK "d" (The Private Key) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### x

**x**: `string`
Expand Down Expand Up @@ -76,6 +68,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_OKP_Public.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ OKP JWK "crv" (The Subtype of Key Pair) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### x

**x**: `string`
Expand Down Expand Up @@ -68,6 +60,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_RSA_Private.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ RSA JWK "e" (Exponent) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### n

**n**: `string`
Expand Down Expand Up @@ -116,6 +108,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_RSA_Public.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ RSA JWK "e" (Exponent) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### n

**n**: `string`
Expand Down Expand Up @@ -68,6 +60,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
16 changes: 8 additions & 8 deletions docs/types/interfaces/JWK_oct.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ Oct JWK "k" (Key Value) Parameter

***

### kty

**kty**: `string`

JWK "kty" (Key Type) Parameter

***

### alg?

`optional` **alg**: `string`
Expand Down Expand Up @@ -60,6 +52,14 @@ JWK "kid" (Key ID) Parameter

***

### kty?

`optional` **kty**: `string`

JWK "kty" (Key Type) Parameter

***

### use?

`optional` **use**: `string`
Expand Down
2 changes: 1 addition & 1 deletion docs/types/interfaces/JWSHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ JWS "crit" (Critical) Header Parameter

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
2 changes: 1 addition & 1 deletion docs/types/interfaces/JWTHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ JWS "crit" (Critical) Header Parameter

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
2 changes: 1 addition & 1 deletion docs/types/interfaces/JoseHeaderParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Support from the community to continue maintaining and improving this module is

### jwk?

`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"kty"` \| `"crv"` \| `"e"` \| `"n"`\>
`optional` **jwk**: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`JWK`](JWK.md), `"x"` \| `"y"` \| `"crv"` \| `"e"` \| `"n"` \| `"kty"`\>

"jwk" (JSON Web Key) Header Parameter

Expand Down
2 changes: 1 addition & 1 deletion src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** Generic JSON Web Key Parameters. */
export interface JWKParameters {
/** JWK "kty" (Key Type) Parameter */
kty: string
kty?: string
/**
* JWK "alg" (Algorithm) Parameter
*
Expand Down

0 comments on commit bb6ccfe

Please sign in to comment.