Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to generate a webhook signature #39

Closed
donaldjarmstrong opened this issue Dec 5, 2014 · 0 comments · Fixed by #40
Closed

Add method to generate a webhook signature #39

donaldjarmstrong opened this issue Dec 5, 2014 · 0 comments · Fixed by #40

Comments

@donaldjarmstrong
Copy link
Contributor

This method would be used to validate the webhook signature is valid.

Based on the documentation:

The signature is calculated as follows:
SHA1-Hex-Digest("{data}{timestamp}{api_secret}")

Usage:

    var data = response.body;
    var x_ts = response.header['X-Cld-Timestamp'];
    var x_sig = response.header['X-Cld-Signature'];

    var sig = cloudinary.utils.webhook_signature(data, x_ts)

    if (sig == x_sig) {
        console.log('valid');
    } else {
        console.log('invalid');
    }
donaldjarmstrong added a commit to donaldjarmstrong/cloudinary_npm that referenced this issue Dec 5, 2014
This is used to validate that the webhook API call is legit.  Closed cloudinary#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant