[][src]Struct slack_http_verifier::SlackHTTPVerifier

pub struct SlackHTTPVerifier { /* fields omitted */ }

Verifies Slack http requests are signed by the given secret. A convenience wrapper around SlackVerifier.

Methods

impl SlackHTTPVerifier[src]

pub fn new<S: AsRef<[u8]>>(secret: S) -> Result<Self, InvalidKeyLengthError>[src]

Returns a new SlackHTTPVerifier.

This code runs with edition 2018

let verifier = SlackHTTPVerifier::new("8f742231b10e8888abcd99yyyzzz85a5").unwrap();

pub fn verify<'a, R>(&self, req: &'a R) -> Result<(), VerificationError> where
    R: HTTPRequest<'a>, 
[src]

Verifies the given request.

This code runs with edition 2018
let slack_sample_timestamp: &str = "1531420618";
let slack_sample_sig: &str =
    "v0=a2114d57b48eac39b9ad189dd8316235a7b4a8d21a10bd27519666489c69b503";
let slack_sample_body: &str = // ...

let verifier = SlackHTTPVerifier::new("8f742231b10e8888abcd99yyyzzz85a5").unwrap();
let req = http::Request::builder()
    .header("X-Slack-Request-Timestamp", slack_sample_timestamp)
    .header("X-Slack-Signature", slack_sample_sig)
    .body(slack_sample_body)
    .unwrap();

assert!(verifier.verify(&req).is_ok())

Trait Implementations

impl Clone for SlackHTTPVerifier[src]

impl Debug for SlackHTTPVerifier[src]

impl Send for SlackHTTPVerifier[src]

impl Sync for SlackHTTPVerifier[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.