@atproto/jwk
Version:
A library for working with JSON Web Keys (JWKs) in TypeScript. This is meant to be extended by environment-specific libraries like @atproto/jwk-jose.
38 lines • 1.59 kB
TypeScript
import { Jwk } from './jwk.js';
import { VerifyOptions, VerifyPayload, VerifyResult } from './jwt-verify.js';
import { JwtHeader, JwtPayload, SignedJwt } from './jwt.js';
export declare abstract class Key {
protected readonly jwk: Readonly<Jwk>;
constructor(jwk: Readonly<Jwk>);
get isPrivate(): boolean;
get isSymetric(): boolean;
get privateJwk(): Jwk | undefined;
get publicJwk(): Jwk | undefined;
get bareJwk(): Jwk | undefined;
get use(): "sig" | "enc";
/**
* The (forced) algorithm to use. If not provided, the key will be usable with
* any of the algorithms in {@link algorithms}.
*
* @see {@link https://datatracker.ietf.org/doc/html/rfc7518#section-3.1 | "alg" (Algorithm) Header Parameter Values for JWS}
*/
get alg(): string | undefined;
get kid(): string | undefined;
get crv(): "P-256" | "P-384" | "P-521" | "secp256k1" | "Ed25519" | "Ed448" | undefined;
/**
* All the algorithms that this key can be used with. If `alg` is provided,
* this set will only contain that algorithm.
*/
get algorithms(): readonly string[];
/**
* Create a signed JWT
*/
abstract createJwt(header: JwtHeader, payload: JwtPayload): Promise<SignedJwt>;
/**
* Verify the signature, headers and payload of a JWT
*
* @throws {JwtVerifyError} if the JWT is invalid
*/
abstract verifyJwt<P extends VerifyPayload = JwtPayload, C extends string = string>(token: SignedJwt, options?: VerifyOptions<C>): Promise<VerifyResult<P, C>>;
}
//# sourceMappingURL=key.d.ts.map