Expand description

A library to secure GitHub Webhooks and extract JSON event payloads in Axum.

The library is an Extractor paired with State to provide the required Secret Token.

Usage looks like:

use axum_github_webhook_extract::{GithubToken, GithubEvent};

#[derive(Debug, Deserialize)]
struct Event {
    action: String,
}

async fn echo(GithubEvent(e): GithubEvent<Event>) -> impl IntoResponse {
    e.action
}

fn app() -> Router {
    Router::new()
        .route("/", get(echo))
        .with_state(GithubToken(Arc::new(String::from("d4705034dd0777ee9e1e3078a12a06985151b76f"))))
}

Structs

  • Verify and extract Github Event Payload.
  • State to provide the Github Token to verify Event signature.