Webhook
Helpers for verifying WorkOS webhook payloads.
This class is independent of com.workos.WorkOS — a webhook handler typically does not have an API key and only needs to validate incoming signatures.
Constructors
Types
Functions
Link copied to clipboard
fun constructEvent(payload: String, signatureHeader: String, secret: String, toleranceMillis: Long = DEFAULT_TOLERANCE_MILLIS): JsonNode
Validate the WorkOS-Signature header against payload and return the parsed event body as a JsonNode. Callers that want a typed view can deserialize the node to a generated model with ObjectMapper.treeToValue, or use constructTypedEvent to do so in a single call.
Link copied to clipboard
fun constructTypedEvent(payload: String, signatureHeader: String, secret: String, toleranceMillis: Long = DEFAULT_TOLERANCE_MILLIS): WorkOSEvent
Verify the signature and return a strongly-typed WorkOSEvent.
Link copied to clipboard
Compute the expected HMAC-SHA256(timestamp.payload) signature.
Link copied to clipboard
Throws SignatureException if the signature is invalid or expired.