FeishuCrypto
public final class FeishuCrypto
io/agentscope/extensions/channel/feishu/FeishuCrypto.java:43–138Feishu Crypto,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.feishu 包。核心成员包括 verifySignature、decrypt、FeishuCrypto。
Implements Feishu callback encryption + signature verification.
Feishu encrypts the callback body when an Encrypt Key is configured in the developer console.
The wire format is JSON {"encrypt":"<base64-ciphertext>"}. The AES key is derived as
SHA-256(encryptKey) (32 bytes). The ciphertext layout is:
| 16 bytes IV | AES-CBC + PKCS#7 padded body |
The signature header X-Lark-Signature is computed as
SHA-256(timestamp + nonce + encryptKey + rawBody) where rawBody is the raw HTTP
request body (the JSON-stringified envelope, not the decrypted plaintext).
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public FeishuCrypto(String encryptKey) | 初始化 `FeishuCrypto` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean verifySignature(String signature, String timestamp, String nonce, String body) | 执行 `verifySignature` 方法。 Verifies the SHA-256 signature: `hex(SHA-256(timestamp + nonce + encryptKey + body))`. |
public String decrypt(String encryptBase64) | 设置该参数。 Decrypts the `encrypt` string from a Feishu callback. |
构造器详情Constructor Detail
FeishuCrypto
public FeishuCrypto(String encryptKey)
初始化 FeishuCrypto 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
encryptKey | String | encrypt 键(类型 `String`)。The encrypt key. |
io/agentscope/extensions/channel/feishu/FeishuCrypto.java:48–59方法详情Method Detail
verifySignature
public boolean verifySignature(String signature, String timestamp, String nonce, String body)
执行 verifySignature 方法。
Verifies the SHA-256 signature: hex(SHA-256(timestamp + nonce + encryptKey + body)).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
signature | String | signature(类型 `String`)。The signature. |
timestamp | String | 时间戳(类型 `String`)。The timestamp. |
nonce | String | nonce(类型 `String`)。The nonce. |
body | String | 正文(类型 `String`)。The body. |
booleanio/agentscope/extensions/channel/feishu/FeishuCrypto.java:65–84decrypt
public String decrypt(String encryptBase64)
设置该参数。
Decrypts the encrypt string from a Feishu callback.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
encryptBase64 | String | encrypt 基类 64(类型 `String`)。The encrypt base 64. |
Stringio/agentscope/extensions/channel/feishu/FeishuCrypto.java:96–115