@bates-solutions/clover API Reference - v1.3.0
    Preparing search index...

    Function verifySignature

    • Verify a Clover Hosted-Checkout webhook signature.

      Clover signs ${timestamp}.${rawBody} with HMAC-SHA256 and sends it in the clover-signature header as t=<ts>,v1=<sig>. This reimplements that scheme with WebCrypto — no SDK, no network, no Node built-ins.

      Parameters

      • rawBody: string

        The raw request body as a string

      • signature: string

        The clover-signature header value

      • signingSecret: string

        Your webhook signing secret

      • Optionaloptions: VerifyOptions

        Verification options (timestamp tolerance)

      Returns Promise<WebhookVerificationResult>

      const result = await verifySignature(rawBody, signature, process.env.CLOVER_WEBHOOK_SECRET!);
      if (!result.valid) return res.status(400).json({ error: result.error });