Skip to content

Webhook.verify_signature()

Methodtryyoursize

Return True or raise SignatureVerificationError.

tolerance is the accepted age in seconds (either direction); 0 or less disables the check. now overrides the clock (unix seconds), for tests.

@staticmethod
def verify_signature(payload: Union[bytes, str], sig_header: str, secret: str, tolerance: int = DEFAULT_TOLERANCE, now: Optional[int] = None) -> bool
payloadUnion[bytes, str]Required

The raw request body.

sig_headerstrRequired

The TYS-Signature header.

secretstrRequired

The signing secret.

toleranceintOptional= DEFAULT_TOLERANCE

Accepted age in seconds.

nowOptional[int]Optional= None

Clock override, for tests.

bool: True, or raises SignatureVerificationError.

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

Was this page helpful?