/** * WeChat MP crypto utilities * * Provides: * - computeSignature: Compute signature for GET verification * - verifySignature: Verify signature for GET validation * - computeMsgSignature: Compute msg_signature for POST validation * - verifyMsgSignature: Verify msg_signature for POST validation (safe mode) * - decryptWechatMpMessage: Decrypt AES encrypted message * - encryptWechatMpMessage: Encrypt plaintext for encrypted reply (safe mode) * - parseWechatMpXml: Parse XML message body * - buildWechatMpXml: Build XML message for passive reply */ import type { ResolvedWechatMpAccount } from "./types.js"; /** * Compute signature for GET callback verification * Used for URL callback verification */ export declare function computeSignature(params: { token: string; timestamp: string; nonce: string; }): string; /** * Verify GET callback signature (URL verification) */ export declare function verifySignature(params: { token: string; timestamp: string; nonce: string; signature: string; }): boolean; /** * Compute msg_signature for POST body validation (safe mode) */ export declare function computeMsgSignature(params: { token: string; timestamp: string; nonce: string; encrypt: string; }): string; /** * Verify msg_signature for POST body validation (safe mode) */ export declare function verifyMsgSignature(params: { token: string; timestamp: string; nonce: string; encrypt: string; msgSignature: string; }): boolean; /** * Decrypt AES-256-CBC encrypted message (safe mode) * Returns the plaintext XML content */ export declare function decryptWechatMpMessage(params: { encodingAESKey: string; encrypt: string; expectedAppId?: string; }): { plaintext: string; appId: string; }; /** * Encrypt plaintext for encrypted reply (safe mode) */ export declare function encryptWechatMpMessage(params: { encodingAESKey: string; appId: string; plaintext: string; }): { encrypt: string; }; /** * Build encrypted reply XML */ export declare function buildEncryptedReplyXml(params: { encrypt: string; signature: string; timestamp: string; nonce: string; }): string; /** * Parse XML message body to structured object (lightweight, no external deps) */ export declare function parseWechatMpXml(xml: string): Record; /** * Build XML message for WeChat MP passive reply */ export declare function buildWechatMpXml(data: Record): string; /** * Build raw XML message (without CDATA escaping) */ export declare function buildWechatMpXmlRaw(data: Record): string; /** * Check if message mode requires encryption */ export declare function isSafeMode(account: ResolvedWechatMpAccount): boolean; /** * Check if plain mode is enabled */ export declare function isPlainMode(account: ResolvedWechatMpAccount): boolean; /** * Check if compat mode is enabled (both encrypted and plain supported) */ export declare function isCompatMode(account: ResolvedWechatMpAccount): boolean; /** * Build plain text reply XML for passive reply */ export declare function buildPlainReplyXml(params: { toUserName: string; fromUserName: string; createTime: number; msgType: "text"; content: string; }): string; //# sourceMappingURL=crypto.d.ts.map