slack-auth-middleware

Crates.ioslack-auth-middleware
lib.rsslack-auth-middleware
version
sourcesrc
created_at2024-11-02 18:43:41.812395
updated_at2025-01-19 21:30:43.006325
descriptionA middleware layer for Axum to authenticate requests from Slack using HMAC signatures.
homepage
repositoryhttps://github.com/reinhash/slack-auth-middleware
max_upload_size
id1433068
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(reinhash)

documentation

README

slack-auth-middleware

A middleware layer for Axum to authenticate requests from Slack using HMAC signatures.

Features

  • Verifies Slack requests using HMAC signatures.
  • Configurable version number and Slack signing secret.
  • Middleware layer for Axum.

Installation

cargo add slack-auth-middleware

Usage

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!"
}

Minimum supported Rust version

Rust 1.79

Commit count: 23

cargo fmt