@hookflo/tern
Version:
A robust, scalable webhook verification framework supporting multiple platforms and signature algorithms
18 lines (17 loc) • 1.24 kB
TypeScript
import { WebhookConfig, WebhookVerificationResult, WebhookPlatform, SignatureConfig } from './types';
export declare class WebhookVerificationService {
static verify(request: Request, config: WebhookConfig): Promise<WebhookVerificationResult>;
private static getVerifier;
private static createAlgorithmBasedVerifier;
private static getLegacyVerifier;
static verifyWithPlatformConfig(request: Request, platform: WebhookPlatform, secret: string, toleranceInSeconds?: number): Promise<WebhookVerificationResult>;
static getPlatformsUsingAlgorithm(algorithm: string): WebhookPlatform[];
static platformUsesAlgorithm(platform: WebhookPlatform, algorithm: string): boolean;
static validateSignatureConfig(config: SignatureConfig): boolean;
static verifyTokenBased(request: Request, webhookId: string, webhookToken: string): Promise<WebhookVerificationResult>;
}
export * from './types';
export { getPlatformAlgorithmConfig, platformUsesAlgorithm, getPlatformsUsingAlgorithm, validateSignatureConfig, } from './platforms/algorithms';
export { createAlgorithmVerifier } from './verifiers/algorithms';
export { createCustomVerifier } from './verifiers/custom-algorithms';
export default WebhookVerificationService;