# tys.webhooks.verifySignature()

> Checks the signature only (throws when it does not verify).

Source: https://docs.tryyoursize.com/reference/node/webhooks-verify-signature/

*Method* · `@tryyoursize/node`

Checks the signature only (throws when it does not verify). Use `constructEvent()` unless you parse the body yourself.

```ts
verifySignature(
    rawBody: RawBody,
    signatureHeader: string | string[] | null | undefined,
    secret: string,
    opts?: ConstructEventOptions,
  ): void
```

## Parameters

- **`rawBody`** (`RawBody`, required): The raw request body.
- **`signatureHeader`** (`string | string[] | null | undefined`, required): The `TYS-Signature` header.
- **`secret`** (`string`, required): The signing secret (`whsec_…`).
- **`opts`** (`ConstructEventOptions`, optional)
  - **`toleranceSeconds`** (`number | undefined`, optional): Maximum |now − t| in seconds (default 300). 0 or less disables the check.
  - **`now`** (`number | Date | undefined`, optional): The current time (unix seconds or a Date); for tests.

## Example

**Node.js**

```ts
tys.webhooks.verifySignature(rawBody, req.headers["tys-signature"], secret); // throws SignatureVerificationError
```

**Python**

```python
tryyoursize.Webhook.verify_signature(payload, sig_header, secret)  # True, or raises SignatureVerificationError
```
