Skip to content

Commit

Permalink
fix: update types to work with ESM + TS (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjf authored Jun 24, 2024
1 parent 7ed1e92 commit c49610d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/get-jwks.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import type { LRUCache } from 'lru-cache'
import type { Agent } from 'https'

export type JWKSignature = { domain: string; alg: string; kid: string }
export type JWK = { [key: string]: any; domain: string; alg: string; kid: string }

export type GetPublicKeyOptions = {
type GetPublicKeyOptions = {
domain?: string
alg?: string
kid?: string
}

export type GetJwksOptions = {
type JWKSignature = { domain: string; alg: string; kid: string }
type JWK = { [key: string]: any; domain: string; alg: string; kid: string }

type GetJwks = {
getPublicKey: (options?: GetPublicKeyOptions) => Promise<string>
getJwk: (signature: JWKSignature) => Promise<JWK>
getJwksUri: (normalizedDomain: string) => Promise<string>
cache: LRUCache<string, JWK>
staleCache: LRUCache<string, JWK>
}

type GetJwksOptions = {
max?: number
ttl?: number
issuersWhitelist?: string[]
Expand All @@ -20,12 +28,9 @@ export type GetJwksOptions = {
timeout?: number
}

export type GetJwks = {
getPublicKey: (options?: GetPublicKeyOptions) => Promise<string>
getJwk: (signature: JWKSignature) => Promise<JWK>
getJwksUri: (normalizedDomain: string) => Promise<string>
cache: LRUCache<string, JWK>
staleCache: LRUCache<string, JWK>
declare namespace buildGetJwks {
export type { JWKSignature, JWK, GetPublicKeyOptions, GetJwksOptions, GetJwks }
}

export default function buildGetJwks(options?: GetJwksOptions): GetJwks
declare function buildGetJwks(options?: GetJwksOptions): GetJwks
export = buildGetJwks

0 comments on commit c49610d

Please sign in to comment.