Webhook security
Learn how to secure web hooks from Bunny by verifying their signature
Last updated
Was this helpful?
Learn how to secure web hooks from Bunny by verifying their signature
Last updated
Was this helpful?
Was this helpful?
signature = request.headers["x-bunny-signature"];
payload = '{"type":"SubscriptionProvisioningChange","payload":{"subscription":{"id":27,"state":"trial","trial_start_date":"2022-06-04","trial_end_date":"2022-06-18","start_date":null,"end_date":null,"auto_renew":false,"account":{"id":33,"name":"Ondricka, Flatley and Kessler"},"tenant":null,"product":{"code":"stealth","name":"Stealth","description":null,"sku":null},"features":[{"code":"users","quantity":1},{"code":"crm","quantity":null}]}}}'
signingKey = "<signing_key>";
valid = BunnyApp::Webhook.verify(signature, payload, signing_key)let signature = req.headers["x-bunny-signature"];
let payload = '{"type":"SubscriptionProvisioningChange","payload":{"subscription":{"id":27,"state":"trial","trial_start_date":"2022-06-04","trial_end_date":"2022-06-18","start_date":null,"end_date":null,"auto_renew":false,"account":{"id":33,"name":"Ondricka, Flatley and Kessler"},"environment":null,"product":{"code":"stealth","name":"Stealth","description":null,"sku":null},"features":[{"code":"users","quantity":1},{"code":"crm","quantity":null}]}}}';
let signingKey = "<signing_key>";
let valid = bunny.webhooks.validate(signature, payload, signingKey);