/** * Verify that a webhook payload was sent by Grantex. * * @deprecated This checks only that the body was signed with your secret. It * commits to nothing time-bound, so a delivery captured once stays valid * forever and can be replayed at will. Prefer {@link verifyWebhook}, which * binds the signature to a timestamp and rejects stale deliveries. * * @param payload - The raw request body string (or Buffer) received from Grantex. * @param signature - The value of the `X-Grantex-Signature` header. * @param secret - The webhook secret returned when the endpoint was created. * @returns `true` if the signature is valid, `false` otherwise. */ export declare function verifyWebhookSignature(payload: string | Buffer, signature: string, secret: string): boolean; export interface VerifyWebhookOptions { /** The raw request body, exactly as received — do not re-serialize it. */ payload: string | Buffer; /** The value of the `X-Grantex-Signature-V2` header. */ signature: string; /** The value of the `X-Grantex-Timestamp` header (unix seconds). */ timestamp: string; /** The webhook secret returned when the endpoint was created. */ secret: string; /** * How old a delivery may be, in seconds. Defaults to 300. Deliveries dated * in the future by more than this are also refused, so a forged clock cannot * buy an attacker an unbounded window. */ toleranceSeconds?: number; } /** * Verify a timestamped webhook delivery. * * Checks that the signature covers `.` and that the * timestamp is recent. Both halves matter: without the signature the timestamp * could be rewritten, and without the timestamp the signature never expires. * * ```ts * const ok = verifyWebhook({ * payload: rawBody, * signature: req.headers['x-grantex-signature-v2'], * timestamp: req.headers['x-grantex-timestamp'], * secret: process.env.GRANTEX_WEBHOOK_SECRET, * }); * ``` * * Pass the untouched request body. A body that has been parsed and * re-serialized will not hash to the same value. */ export declare function verifyWebhook(options: VerifyWebhookOptions): boolean; //# sourceMappingURL=webhook.d.ts.map