Crates.io | slack-auth-middleware |
lib.rs | slack-auth-middleware |
version | 0.1.3 |
source | src |
created_at | 2024-11-02 18:43:41.812395 |
updated_at | 2024-11-04 15:40:50.828892 |
description | A middleware layer for Axum to authenticate requests from Slack using HMAC signatures. |
homepage | |
repository | https://github.com/reinhash/slack-auth-middleware |
max_upload_size | |
id | 1433068 |
size | 17,310 |
A middleware layer for Axum to authenticate requests from Slack using HMAC signatures.
cargo add slack-auth-middleware
use axum::{routing::get, Router};
use slack_auth_middleware::{SlackAuthConfig, SlackAuthLayer};
use tracing_subscriber;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let config = SlackAuthConfig {
version_number: "v0".to_string(),
slack_signing_secret: "123".to_string(),
};
let app = Router::new().route("/", get(root).layer(SlackAuthLayer::new(config)));
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn root() -> &'static str {
"Hello, World!"
}
Rust 1.79