verify

fun verify(msgBody: String, msgId: String?, msgSignature: String?, msgTimestamp: String?): WebhookRequest?

Verifies a webhook message. When the verification fails, throws WebhookVerificationException.

If the verification fails, the caller should not trust the request. It is recommended to simply log the failure and ignore the request.

msgId, msgSignature and msgTimestamp are declared nullable for convenience. If any of the parameters are null, the verification fails.

Parameters

msgBody

the body of the request.

msgId

the value of the header whose name equals HEADER_ID.

msgSignature

the value of the header whose name equals HEADER_SIGNATURE.

msgTimestamp

the value of the header whose name equals HEADER_TIMESTAMP.

Throws

when the verification fails.