Class FeishuCrypto
java.lang.Object
io.agentscope.extensions.channel.feishu.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).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
FeishuCrypto
-
-
Method Details
-
verifySignature
Verifies the SHA-256 signature:hex(SHA-256(timestamp + nonce + encryptKey + body)). Returns false when any argument is null or the digest mismatches. -
decrypt
Decrypts theencryptstring from a Feishu callback. Returns the JSON plaintext as a UTF-8 string.Layout after base64-decoding:
| 16 bytes IV | AES-256-CBC + PKCS#7 padded plaintext |
-