Function github_webhook_message_validator::validate
[−]
[src]
pub fn validate(secret: &[u8], signature: &[u8], message: &[u8]) -> bool
Check a signature and a message 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. Use the rustc_serialize
From_Hex
trait to do this.
Examples
use github_webhook_message_validator::validate; let signature = &vec![ 0x73, 0x6d, 0x7f, 0x93, 0x42, 0xf2, 0xa7, 0xd2, 0x39, 0xaf, 0xa5, 0x51, 0x3a, 0x4b, 0xb2, 0x28, 0x3e, 0x0e, 0x15, 0x88 ]; let secret = "some-secret".as_bytes(); let message = "blah-blah-blah".as_bytes(); assert_eq!(validate(secret, signature, message), true);