Skip to main content

wecomx_auth/
lib.rs

1//! WeCom 认证能力库:凭证存储、Token Provider 与 AI Bot CLI 网关协议。
2//!
3//! 与运行方式(CLI / 服务端 / Agent)无关的认证构件:
4//!
5//! - [`bot`]:Bot 凭据(`botid + secret`);
6//! - [`credentials`]:[`CredentialStore`](credentials::CredentialStore) 抽象与
7//!   [`MemoryCredentialStore`](credentials::MemoryCredentialStore) 内存实现;
8//! - [`file_store`]:[`EncryptedFileCredentialStore`](file_store::EncryptedFileCredentialStore)
9//!   (AES-256-GCM 加密文件 + keyring 回退);
10//! - [`provider`]:[`TokenProvider`](provider::TokenProvider) 抽象与
11//!   [`BotGatewayTokenProvider`](provider::BotGatewayTokenProvider)
12//!   (botid+secret 签名引导换取 Bearer token,含并发刷新合并);
13//! - [`bootstrap`]:`sha256_hex(secret + bot_id + time + nonce)` 签名与引导调用;
14//! - [`gateway`]:AI Bot CLI 网关协议(扁平响应信封 + 鉴权能力标记 + 引导端点装配);
15//! - [`qrcode`]:扫码登录的网络流程(创建会话 → 轮询结果);
16//! - [`legacy_migration`]:旧版凭据(`bot.enc`/`token.enc`)自动迁移;
17//! - [`error`]:统一错误 [`AuthError`](error::AuthError)(错误码段 893300–893399)。
18
19pub mod bootstrap;
20pub mod bot;
21pub mod credentials;
22pub mod crypto;
23pub mod error;
24pub mod file_store;
25pub mod gateway;
26pub mod legacy_migration;
27pub mod provider;
28pub mod qrcode;
29
30pub use bootstrap::{BindSource, FetchAuthRequest, FetchAuthResponse, fetch_auth, sign};
31pub use bot::BotCredential;
32pub use credentials::{CredentialStore, Credentials, MemoryCredentialStore};
33pub use error::AuthError;
34pub use file_store::EncryptedFileCredentialStore;
35pub use gateway::{
36    DEFAULT_AUTH_ENDPOINT, FlatRes, NestedRes, RequireAuth, SuppressAuth, auth_endpoint,
37};
38pub use legacy_migration::try_migrate_legacy_credentials;
39pub use provider::{AccessToken, BotGatewayTokenProvider, TokenProvider};
40pub use qrcode::QrSession;