[−][src]Struct slack_http_verifier::SlackHTTPVerifier
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]
R: HTTPRequest<'a>,
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]
fn clone(&self) -> SlackHTTPVerifier
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SlackHTTPVerifier
[src]
impl Send for SlackHTTPVerifier
[src]
impl Sync for SlackHTTPVerifier
[src]
Auto Trait Implementations
impl RefUnwindSafe for SlackHTTPVerifier
impl Unpin for SlackHTTPVerifier
impl UnwindSafe for SlackHTTPVerifier
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,