Skip to main content

Module webhook

Module webhook 

Source
Expand description

Webhook 触发处理模块

实现 Webhook 触发器的签名验证和请求解析功能。

§功能

  • HMAC-SHA256 签名验证
  • 请求体解析
  • 可配置端点路径

§示例

use aster::auto_reply::webhook::{WebhookHandler, WebhookResult};

let handler = WebhookHandler::new("my-secret".to_string(), "/webhook".to_string());

// 验证并处理请求
match handler.handle_request(body, signature) {
    WebhookResult::Triggered { request } => {
        println!("Webhook triggered: {}", request.content);
    }
    WebhookResult::InvalidSignature => {
        println!("Invalid signature");
    }
    WebhookResult::ParseError(err) => {
        println!("Parse error: {}", err);
    }
}

Structs§

WebhookHandler
Webhook 处理器
WebhookRequest
Webhook 请求体

Enums§

WebhookResult
Webhook 处理结果