Webhook.verify_signature()
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.
@staticmethoddef verify_signature(payload: Union[bytes, str], sig_header: str, secret: str, tolerance: int = DEFAULT_TOLERANCE, now: Optional[int] = None) -> boolParameters
Section titled “Parameters”payloadUnion[bytes, str]RequiredThe raw request body.
sig_headerstrRequiredThe TYS-Signature header.
secretstrRequiredThe signing secret.
toleranceintOptional= DEFAULT_TOLERANCEAccepted age in seconds.
nowOptional[int]Optional= NoneClock override, for tests.
Returns
Section titled “Returns”bool: True, or raises SignatureVerificationError.
Example
Section titled “Example”tryyoursize.Webhook.verify_signature(payload, sig_header, secret) # True, or raises SignatureVerificationErrortys.webhooks.verifySignature(rawBody, req.headers["tys-signature"], secret); // throws SignatureVerificationErrorWas this page helpful?
Thank you. We read every answer.