Skip to main content

Overview

This recipe shows you how to use the node.js crypto module to verify the signature of an incoming webhook with an RSA public key. It also includes an example of using the verified function as an express middleware to protect your route from unauthorized webhooks.

Step 1: Import public key

Download the Issuing API Webhook public key and use it in your code to verify notifications sent from our servers.

Step 2: Declare middleware for signature verification

Implement a middleware to automatically verify all webhook requests.

Step 3: Apply middleware to route handler

Attach the middleware to your route handler to utilize it effectively. For better reliability of webhook delivery, consider using a messaging queue like RabbitMQ or Kafka to process webhooks, which will help in separating webhook processing from delivery. This decoupling will ensure the highest possible webhook delivery success rate.

Next Steps