UNPKG

http-message-signatures

Version:
26 lines (25 loc) 1.31 kB
/// <reference types="node" /> import { BinaryLike, KeyLike, SignKeyObjectInput, SignPrivateKeyInput, VerifyKeyObjectInput, VerifyPublicKeyInput } from 'crypto'; import { SigningKey, Algorithm, Verifier } from '../types'; /** * A helper method for easier consumption of the library. * * Consumers of the library can use this function to create a signer "out of the box" using a PEM * file they have access to. * * @todo - read the key and determine its type automatically to make usage even easier */ export declare function createSigner(key: BinaryLike | KeyLike | SignKeyObjectInput | SignPrivateKeyInput, alg: Algorithm, id?: string): SigningKey; /** * A helper method for easier consumption of the library. * * Consumers of the library can use this function to create a verifier "out of the box" using a PEM * file they have access to. * * Verifiers are a little trickier as they will need to be produced "on demand" and the consumer will * need to implement some logic for looking up keys by id (or other aspects of the request if no keyid * is supplied) and then returning a validator * * @todo - attempt to look up algorithm automatically */ export declare function createVerifier(key: BinaryLike | KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, alg: Algorithm): Verifier;