pub struct NotifyHandler { /* private fields */ }Expand description
消息推送处理器
Implementations§
Source§impl NotifyHandler
impl NotifyHandler
Sourcepub fn new(config: NotifyConfig) -> NotifyHandler
pub fn new(config: NotifyConfig) -> NotifyHandler
创建处理器
Sourcepub fn config(&self) -> &NotifyConfig
pub fn config(&self) -> &NotifyConfig
配置引用
Sourcepub fn verify_url(&self, query: &NotifyQuery) -> Result<String, NotifyError>
pub fn verify_url(&self, query: &NotifyQuery) -> Result<String, NotifyError>
处理 URL 验证 GET 请求,成功返回 echostr
Sourcepub fn parse_incoming(
&self,
query: &NotifyQuery,
body: &str,
) -> Result<IncomingMessage, NotifyError>
pub fn parse_incoming( &self, query: &NotifyQuery, body: &str, ) -> Result<IncomingMessage, NotifyError>
解析 POST 推送包体,返回明文消息
Sourcepub fn decrypt_body(
&self,
query: &NotifyQuery,
body: &str,
) -> Result<String, NotifyError>
pub fn decrypt_body( &self, query: &NotifyQuery, body: &str, ) -> Result<String, NotifyError>
仅解密得到明文字符串
Sourcepub fn encrypt_reply(
&self,
plain: &str,
timestamp: i64,
nonce: &str,
) -> Result<EncryptedReply, NotifyError>
pub fn encrypt_reply( &self, plain: &str, timestamp: i64, nonce: &str, ) -> Result<EncryptedReply, NotifyError>
构造安全模式加密回包(JSON)
Sourcepub fn reply_success() -> &'static str
pub fn reply_success() -> &'static str
成功应答:空串 / success(多数事件无需加密)
Auto Trait Implementations§
impl Freeze for NotifyHandler
impl RefUnwindSafe for NotifyHandler
impl Send for NotifyHandler
impl Sync for NotifyHandler
impl Unpin for NotifyHandler
impl UnsafeUnpin for NotifyHandler
impl UnwindSafe for NotifyHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more