#github #webhook

github_webhook_message_validator

Provides functions for validating GitHub webhook payloads

6 releases

Uses old Rust 2015

0.1.6 Jul 21, 2022
0.1.5 Nov 1, 2020
0.1.3 Feb 13, 2019
0.1.2 Mar 29, 2017
0.1.1 Feb 7, 2016

#416 in Rust patterns

Download history 77/week @ 2022-08-17 61/week @ 2022-08-24 70/week @ 2022-08-31 211/week @ 2022-09-07 133/week @ 2022-09-14 157/week @ 2022-09-21 104/week @ 2022-09-28 37/week @ 2022-10-05 31/week @ 2022-10-12 31/week @ 2022-10-19 66/week @ 2022-10-26 45/week @ 2022-11-02 66/week @ 2022-11-09 83/week @ 2022-11-16 23/week @ 2022-11-23 41/week @ 2022-11-30

223 downloads per month

MIT license

4KB

GitHub webhook message validator

This package currently contains a single utility function, which may be used to validate the package of a GitHub webhook request against a shared secret.

Note that if you get the signature from the X-Hub-Signature header, you'll need to convert it to bytes via hex. One way is to use the hex crate decode_to_slice function.

Example

use github_webhook_message_validator::validate;

let signature = &vec![
    115, 109, 127, 147, 66, 242, 167, 210, 57, 175, 165, 81, 58, 75, 178, 40, 62, 14, 21, 136
];
let secret = b"some-secret";
let message = b"blah-blah-blah";

assert_eq!(validate(secret, signature, message), true);

lib.rs:

The github_webhook_message_validator crate provides functions to validating GitHub webhook notifications.

Dependencies

~395KB