diff --git a/docs/interfaces/types.CompactJWEHeaderParameters.md b/docs/interfaces/types.CompactJWEHeaderParameters.md index 6a09a8ab0e..466c082d45 100644 --- a/docs/interfaces/types.CompactJWEHeaderParameters.md +++ b/docs/interfaces/types.CompactJWEHeaderParameters.md @@ -69,7 +69,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/docs/interfaces/types.CompactJWSHeaderParameters.md b/docs/interfaces/types.CompactJWSHeaderParameters.md index d1b18d960c..3aff524711 100644 --- a/docs/interfaces/types.CompactJWSHeaderParameters.md +++ b/docs/interfaces/types.CompactJWSHeaderParameters.md @@ -69,7 +69,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/docs/interfaces/types.JWEHeaderParameters.md b/docs/interfaces/types.JWEHeaderParameters.md index cdb672bb89..f3c886d254 100644 --- a/docs/interfaces/types.JWEHeaderParameters.md +++ b/docs/interfaces/types.JWEHeaderParameters.md @@ -69,7 +69,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/docs/interfaces/types.JWSHeaderParameters.md b/docs/interfaces/types.JWSHeaderParameters.md index b0da159670..5e0e9c5fe5 100644 --- a/docs/interfaces/types.JWSHeaderParameters.md +++ b/docs/interfaces/types.JWSHeaderParameters.md @@ -69,7 +69,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/docs/interfaces/types.JWTHeaderParameters.md b/docs/interfaces/types.JWTHeaderParameters.md index b01ba9beed..2a3fa8cf7a 100644 --- a/docs/interfaces/types.JWTHeaderParameters.md +++ b/docs/interfaces/types.JWTHeaderParameters.md @@ -69,7 +69,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/docs/interfaces/types.JoseHeaderParameters.md b/docs/interfaces/types.JoseHeaderParameters.md index fac294f840..c8dead422d 100644 --- a/docs/interfaces/types.JoseHeaderParameters.md +++ b/docs/interfaces/types.JoseHeaderParameters.md @@ -39,7 +39,7 @@ ___ ### jwk -• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"crv"`` \| ``"e"`` \| ``"n"`` \| ``"kty"``\> +• `Optional` **jwk**: [`Pick`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys )\<[`JWK`](types.JWK.md), ``"x"`` \| ``"y"`` \| ``"kty"`` \| ``"crv"`` \| ``"e"`` \| ``"n"``\> "jwk" (JSON Web Key) Header Parameter. diff --git a/src/index.ts b/src/index.ts index cc9aedd817..fa6c34a51c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,14 @@ export * as base64url from './util/base64url.js' export type { KeyLike, JWK, + JWKParameters, + JWK_OKP_Public, + JWK_OKP_Private, + JWK_EC_Public, + JWK_EC_Private, + JWK_RSA_Public, + JWK_RSA_Private, + JWK_oct, FlattenedJWSInput, GeneralJWSInput, FlattenedJWS, diff --git a/src/types.d.ts b/src/types.d.ts index 5c076009a2..d1cdb24950 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -121,6 +121,8 @@ export interface JWKParameters { x5u?: string /** JWK "kid" (Key ID) Parameter. */ kid?: string + + [propName: string]: unknown } /** Convenience interface for Public OKP JSON Web Keys */ @@ -129,12 +131,16 @@ export interface JWK_OKP_Public extends JWKParameters { crv: string /** The public key */ x: string + + [propName: string]: unknown } /** Convenience interface for Private OKP JSON Web Keys */ export interface JWK_OKP_Private extends JWK_OKP_Public, JWKParameters { /** The Private Key */ d: string + + [propName: string]: unknown } /** Convenience interface for Public EC JSON Web Keys */ @@ -145,12 +151,16 @@ export interface JWK_EC_Public extends JWKParameters { x: string /** Y Coordinate */ y: string + + [propName: string]: unknown } /** Convenience interface for Private EC JSON Web Keys */ export interface JWK_EC_Private extends JWK_EC_Public, JWKParameters { /** ECC Private Key */ d: string + + [propName: string]: unknown } /** Convenience interface for Public RSA JSON Web Keys */ @@ -159,6 +169,8 @@ export interface JWK_RSA_Public extends JWKParameters { e: string /** Modulus */ n: string + + [propName: string]: unknown } /** Convenience interface for Private RSA JSON Web Keys */ @@ -181,12 +193,16 @@ export interface JWK_RSA_Private extends JWK_RSA_Public, JWKParameters { q: string /** First CRT Coefficient */ qi: string + + [propName: string]: unknown } /** Convenience interface for oct JSON Web Keys */ export interface JWK_oct extends JWKParameters { /** Key Value */ k: string + + [propName: string]: unknown } /** diff --git a/test/types/index.test-d.ts b/test/types/index.test-d.ts index 829e982734..2615e1cbb0 100644 --- a/test/types/index.test-d.ts +++ b/test/types/index.test-d.ts @@ -40,9 +40,15 @@ expectType(await lib.importX509('', 'RS256')) expectType(await lib.importX509('', 'RS256')) expectType(await lib.importX509('', 'RS256')) -expectType(await lib.importJWK({ kty: 'RSA' })) -expectType(await lib.importJWK({ kty: 'RSA' })) -expectType(await lib.importJWK({ kty: 'RSA' })) +expectType( + await lib.importJWK({ kty: 'OKP', crv: '', x: '' }), +) +expectType( + await lib.importJWK({ kty: 'OKP', crv: '', x: '' }), +) +expectType( + await lib.importJWK({ kty: 'OKP', crv: '', x: '' }), +) { const result = await lib.jwtVerify('', lib.createLocalJWKSet({ keys: [] }))