WeComCrypto
public final class WeComCrypto
io/agentscope/extensions/channel/wecom/WeComCrypto.java:40–166WeCom Crypto,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.wecom 包。核心成员包括 verifySignature、decrypt、WeComCrypto。
Implements WeCom's URL-handshake signature + AES-CBC + PKCS#7 encrypt / decrypt scheme. See WeCom callback specification.
Inputs:
-
token— the developer-supplied callback token. -
encodingAesKey— 43-character base64 (no padding). Decoded with appended"="to yield a 32-byte AES key. The first 16 bytes are also used as the CBC IV. -
receiveId— the corp id (for self-built apps) or suite id (for ISV apps). Decryption verifies the trailing receive-id against this value.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public WeComCrypto(String token, String encodingAesKey, String receiveId) | 初始化 `WeComCrypto` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean verifySignature(String signature, String timestamp, String nonce, String encrypt) | 执行 `verifySignature` 方法。 Verifies the SHA-1 signature produced by sorting `[token, timestamp, nonce, encrypt]`,
concatenating, and hashing. |
public String decrypt(String encryptBase64) | 设置该参数。 Decrypts the `Encrypt` body and returns the inner XML payload as a UTF-8 string. |
构造器详情Constructor Detail
WeComCrypto
public WeComCrypto(String token, String encodingAesKey, String receiveId)
初始化 WeComCrypto 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
token | String | 令牌(类型 `String`)。The token. |
encodingAesKey | String | encoding Aes 键(类型 `String`)。The encoding aes key. |
receiveId | String | 接收标识(类型 `String`)。The receive id. |
io/agentscope/extensions/channel/wecom/WeComCrypto.java:47–68方法详情Method Detail
verifySignature
public boolean verifySignature(String signature, String timestamp, String nonce, String encrypt)
执行 verifySignature 方法。
Verifies the SHA-1 signature produced by sorting [token, timestamp, nonce, encrypt], concatenating, and hashing.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
signature | String | signature(类型 `String`)。The signature. |
timestamp | String | 时间戳(类型 `String`)。The timestamp. |
nonce | String | nonce(类型 `String`)。The nonce. |
encrypt | String | encrypt(类型 `String`)。The encrypt. |
booleanio/agentscope/extensions/channel/wecom/WeComCrypto.java:74–96decrypt
public String decrypt(String encryptBase64)
设置该参数。
Decrypts the Encrypt body and returns the inner XML payload as a UTF-8 string.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
encryptBase64 | String | encrypt 基类 64(类型 `String`)。The encrypt base 64. |
Stringio/agentscope/extensions/channel/wecom/WeComCrypto.java:107–143