/opt/canhelp/node_modules/svix/src
NameSizeModeActions
api/-0755rm
models/-0755rm
HttpErrors.ts25480644editdlrm
index.test.ts790644editdlrm
index.ts47940644editdlrm
KitchenSink.test.ts22270644editdlrm
mockttp.test.ts220890644editdlrm
request.ts72380644editdlrm
util.ts5220644editdlrm
webhook.test.ts62550644editdlrm
webhook.ts14560644editdlrm
Edit: /opt/canhelp/node_modules/svix/src/webhook.ts (1456B)
import { Webhook as StdWh } from "standardwebhooks"; export { WebhookVerificationError } from "standardwebhooks"; export interface WebhookRequiredHeaders { "svix-id": string; "svix-timestamp": string; "svix-signature": string; } export interface WebhookUnbrandedRequiredHeaders { "webhook-id": string; "webhook-timestamp": string; "webhook-signature": string; } export interface WebhookOptions { format?: "raw"; } export class Webhook { private readonly inner: StdWh; constructor(secret: string | Uint8Array, options?: WebhookOptions) { this.inner = new StdWh(secret, options); } public verify( payload: string | Buffer, headers_: | WebhookRequiredHeaders | WebhookUnbrandedRequiredHeaders | Record ): unknown { const headers: Record = {}; for (const key of Object.keys(headers_)) { headers[key.toLowerCase()] = (headers_ as Record)[key]; } headers["webhook-id"] = headers["svix-id"] ?? headers["webhook-id"] ?? ""; headers["webhook-signature"] = headers["svix-signature"] ?? headers["webhook-signature"] ?? ""; headers["webhook-timestamp"] = headers["svix-timestamp"] ?? headers["webhook-timestamp"] ?? ""; return this.inner.verify(payload, headers); } public sign(msgId: string, timestamp: Date, payload: string | Buffer): string { return this.inner.sign(msgId, timestamp, payload); } }