httpbis-digest-headers
Version:
Create and verify content digests as found in HTTP headers according to draft-ietf-httpbis-digest-headers
19 lines (18 loc) • 830 B
TypeScript
/// <reference types="node" />
export declare type DigestAlgorithm = 'sha-256' | 'sha-512';
/**
* Create the content-digest header for a given message body
*
* @param body the message body
* @param algorithms the digest algorithms to use (only 'sha-256' and 'sha-512' supported)
* @returns the string that can be used as the content-digest header value
*/
export declare function createContentDigestHeader(body: string | Buffer | undefined, algorithms: DigestAlgorithm[]): string;
/**
* Verify a content-digest header against a message body
*
* @param body the message body
* @param digestHeader the content-digest header
* @returns true if all digests in the header are verified, false if not
*/
export declare function verifyContentDigest(body: string | Buffer | undefined, digestHeader: string): false | undefined;