Light Logo
JavaScript SDK (v0.56.0)Reference

verifyWebhook

Verify webhook signature.

Function: verifyWebhook()

verifyWebhook(params): Promise<void>

Verify webhook signature.

Parameters

params

VerifyWebhookParams

Parameters for verifying the webhook signature. tolerance defaults to 300, scheme defaults to "v1" and keyCacheSize defaults to 50. When the cache size is exceeded, the oldest cached key is evicted. The cache is a performance optimization only, and a size of 0 or a negative value disables caching.

Returns

Promise<void>

Throws

Error thrown when the timestamp is missing from the signature.

Throws

Error thrown when a signature matching the scheme is missing.

Throws

Error thrown when the signature does not match the expected one.

Throws

Error thrown when the timestamp is outside the tolerance window.