github_webhook_message_validator

Crates.iogithub_webhook_message_validator
lib.rsgithub_webhook_message_validator
version0.1.6
sourcesrc
created_at2016-02-07 00:25:43.811683
updated_at2022-07-21 22:31:39.84298
descriptionProvides functions for validating GitHub webhook payloads.
homepagehttps://github.com/qubyte/github_webhook_message_validator
repositoryhttps://github.com/qubyte/github_webhook_message_validator
max_upload_size
id4110
size8,245
Mark S. Everitt (qubyte)

documentation

README

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);
Commit count: 33

cargo fmt