UNPKG

@guarani/jose

Version:

Implementation of the RFCs of the JOSE Working Group.

56 lines (55 loc) 2.31 kB
import { Optional } from '@guarani/types'; import { JsonWebKey } from '../jwk/jsonwebkey'; import { JsonWebKeyParams } from '../jwk/jsonwebkey.params'; import { JsonWebKeySetParams } from './jsonwebkeyset.params'; /** * Implementation of {@link https://www.rfc-editor.org/rfc/rfc7517.html#section-5 RFC 7517 Section 5}. */ export declare class JsonWebKeySet implements JsonWebKeySetParams { /** * JSON Web Keys registered at the JSON Web Key Set. */ readonly keys: JsonWebKey[]; /** * Instantiates a new JSON Web Key Set based on the provided JSON Web Keys. * * @param keys JSON Web Keys to be registered at the JSON Web Key Set. */ constructor(keys: JsonWebKey[]); /** * Loads the data of the provided JSON Web Key Parameters into a JSON Web Key based on the Key Type. * * @param params Parameters of the JSON Web Key. * @returns JSON Web Key based on the Key Type of the provided Parameters. */ private static _loadJsonWebKey; /** * Loads the provided Parameters into a JSON Web Key Set. * * @param params Parameters of the JSON Web Key Set. * @returns JSON Web Key Set based on the provided Parameters. */ static load(params: JsonWebKeySetParams): JsonWebKeySet; /** * Parses a JSON String into a JSON Web Key Set. * * @param data JSON String representation of the JSON Web Key Set to be parsed. * @returns Instance of a JSON Web Key Set based on the provided JSON String. */ static parse(data: string): JsonWebKeySet; /** * Finds and returns a JSON Web Key based on the provided Parameters. * * @param params Parameters of the requested JSON Web Key. * @returns JSON Web Key based on the required Parameters. */ getKeyOrNone<T extends JsonWebKey>(params: JsonWebKeyParams): Optional<T>; /** * Returns a JSON Web Key based on the provided Parameters, otherwise, throws an Exception. * * @param params JSON Web Key containing the required Parameters. * @throws {JsonWebKeyNotFoundException} The requested JSON Web Key is not registered at the JSON Web Key Set. * @returns JSON Web Key based on the required Parameters. */ getKeyOrThrow<T extends JsonWebKey>(params: JsonWebKeyParams): T; }