Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JwkStore

Singleton service class to register and retrieve JSON Web Keys.

Hierarchy

  • JwkStore

Index

Constructors

Protected constructor

  • Returns JwkStore

Properties

Protected localCryptoKeys

localCryptoKeys: [RegExp, Jwk][] = []

Protected remoteCryptoCache

remoteCryptoCache: Map<string, CryptoKey> = new Map()

Protected remoteCryptoOrigins

remoteCryptoOrigins: string[] = []

Methods

addHost

  • addHost(url: string): void
  • Register a new trustworthy URL to retrieve JSON Web Keys from.

    Parameters

    • url: string

      the URL to register

    Returns void

addJwk

  • addJwk(test: RegExp, jwk: Jwk): void
  • Registers a new JSON Web Key in the store.

    Parameters

    • test: RegExp

      a regular expression to check if this key is applicable

    • jwk: Jwk

      the JSON Web Key to register

    Returns void

getJwk

  • getJwk(iss: string, jku?: undefined | string): Promise<CryptoKey>
  • Retrieves a JSON Web Key for the given environment URL.

    Parameters

    • iss: string

      the environment URL provided in the iss claim of the token

    • Optional jku: undefined | string

    Returns Promise<CryptoKey>

    a promise holding the corresponding Crypto key

loadJwk

  • loadJwk(url: string, timeout?: number): Promise<CryptoKey>
  • Retrieves a JSON Web Key from the given URL.

    Parameters

    • url: string

      the remote URL that hosts the JWK data

    • Default value timeout: number = 60000

      the request timeout in milliseconds

    Returns Promise<CryptoKey>

    a promise holding the corresponding Crypto key

reset

  • reset(): void
  • Resets the store.

    Returns void

Static getInstance

  • Retrieves the singleton instance of this service class.

    Returns JwkStore

    the singleton instance

Generated using TypeDoc