Skip to content

Repository containing an example to verify request security, even if the message is being sent over a compromised channel.

Notifications You must be signed in to change notification settings

EmielBruijntjes/webhook-security

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Webhook security

If you use a PHP scripts to process webhooks from Copernica, you can use the classes inside this repository to verify these incoming webhook requests.

Copernica adds a digital signature to each outgoing webhook call. With the classes inside this repository you can automatically check this signature. This prevents that your webhook handling script will ever be fed with data that does not come from Copernica.com.

Installation

Package can be installed via composer cli, executing following line.

composer require copernica/webhook-security

Usage

Below is an example script that verifies the message to be authentic, recent and from Copernica.

// Include the security header file
require_once('Copernica/Webhook.php');

// Construct the object. You need to pass the hostname on which the 
// calls are supposed to come in, the path name and your customer ID
// (which is an integer)
$webhook = new Copernica\Webhook("customername.com", "/path/to/script.php", 'account_1234');

// @todo process the actual data
$data = json_decode($webhook->body());

About

Repository containing an example to verify request security, even if the message is being sent over a compromised channel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%