UNPKG

@tnwx/commons

Version:

TTNWX 微信系开发脚手架之公共模块

31 lines (30 loc) 891 B
/// <reference types="node" /> import * as xml2js from 'xml2js'; import { ApiConfig } from '@tnwx/accesstoken'; export declare class CryptoKit { static xmlParser: xml2js.Builder; aesModel: string; token: string; appId: string; encodingAesKey: Buffer; iv: Buffer; msgSignature: string; timestamp: string; nonce: string; constructor(config: ApiConfig, msgSignature: string, timestamp: string, nonce: string); getMsgSignature(encryptedMsg: string): string; decrypt(echostr: string): string; /** * 微信消息解密 * @param encryptMsg 加密字符串 */ decryptMsg(encryptMsg: string): any; /** * 微信消息加密 * @param xmlMsg */ encryptMsg(xmlMsg: string): string; KCS7Encoder(textLength: number): string; PKCS7Decoder(buff: Buffer): Buffer; parseXmlToObj(xml: string): any; }