Webhook payload
The exact request a worker sends, and the verification result.
POST to the rule's url, content-type: application/json.
Body
type WebhookBody = {
event: string // the same for every retry of one firing
rule: Hex
ruleName?: string
trigger: 'expire' | 'block'
target?: Hex // expire rules
deadline: string // block, as a decimal string
firedAt: string // block, as a decimal string
message?: string // with placeholders filled
worker: Hex
test?: boolean
}Headers
| Header | Value |
|---|---|
x-trg-sig | EIP-191 signature by the worker over the exact body text |
x-trg-worker | The worker's address |
x-trg-rule | The rule's key |
x-trg-event | The event ID (not covered by the signature; use body.event) |
Verifying
verifyWebhook(rawBody: string, signature: string | null | undefined, trusted: readonly Hex[]): Promise<VerifyResult>
type VerifyResult = { ok: true; worker: Hex } | { ok: false; reason: string }Pass the body exactly as received, before any parsing. reason is human-readable, such as
"missing x-trg-sig header", "malformed signature", or that the signer is not trusted.