onfido_v3 v0.1.3 Onfido.Resources.Webhook
Link to this section Summary
Functions
Delete a webhook
Edit a webhook
Get a webhook
List webhooks
Register a webhook
Verify signature on requests to Onfido webhook Based on https://developers.onfido.com/guide/manual-webhook-signature-verification
Link to this section Functions
Link to this function
delete(webhook_id)
Delete a webhook
Example
Onfido.Resources.Webhook.delete("<webhook-id>")
Link to this function
edit(webhook_id, params)
Edit a webhook
Example
Onfido.Resources.Webhook.delete("<webhook-id>")
Link to this function
get(webhook_id)
Get a webhook
Example
Onfido.Resources.Webhook.get("<webhook-id>")
Link to this function
list()
List webhooks
Example
Onfido.Resources.Webhook.list()
Link to this function
register(params)
Register a webhook
Example
Onfido.Resources.Webhook.register(%{
url: "https://yourwebserver.com",
enabled: true,
environments: ["live", "sandbox"],
events: [
"report.completed",
"check.completed"
]
})
Link to this function
verify_webhook_signature(webhook_token, signature_header, raw_event_body)
Verify signature on requests to Onfido webhook Based on https://developers.onfido.com/guide/manual-webhook-signature-verification
Signature comparison requires raw_event_body as a string Once signature is verified it is safe to parse raw_event_body returned from this function
If using Plug, get raw_event_body and signature_header like so:
{:ok, raw_event_body, conn} = read_body(conn)
signature_header =
get_req_header(conn, "X-SHA2-Signature")
|> Base.decode64()
Example
Onfido.Resources.Webhook.verify_signature(webhook_token, signature_header, raw_event_body)