import { WeChatMiniProgramConfig } from './config'; import Store, { StoreMiniProgramItem } from './store/Store'; import { WeChatOptions } from './WeChatOptions'; /** * Wechat mini program class, must have "options.miniProgram" option * @return {MiniProgram} MiniProgram instance */ declare class MiniProgram { miniProgramOptions: WeChatMiniProgramConfig; options: WeChatOptions; appId: string; appSecret: string; store: Store; constructor(options: WeChatOptions); /** * Get the new session from wechat * @param code - code from wx.login() * @param key - key used to store the session data, default will use the openid * @return {Promise} */ getSession(code: string, key: string): Promise; /** * Generate mini program signature with raw data and session key * @param {string} rawDataString * @param sessionKey * @return {Promise} Promise - generated signature */ genSignature(rawDataString: string, sessionKey: string): Promise; /** * Verify the provided signature and generated signature with the rawData * @param {object|string} rawData - raw data on which the signature will be generated * @param {string} signature - on which the generated signature will be compared upon * @param sessionKey * @return {Promise} Promise - resolved if signatures match, otherwise reject */ verifySignature(rawData: string | Record, signature: string, sessionKey: string): Promise; /** * Decrypt data from wechat * @param {string} encryptedData * @param {string} iv * @param {string=} sessionKey - session_key used to decrypt encryptedData * @param {string=} key - get the session_key with key(usually is openid) from Store if the above "sessionKey" is not provided * @return {Promise} Promise - resolved/rejected with decrypted data or Error */ decryptData(encryptedData: string, iv: string, sessionKey?: string, key?: string): Promise>; } export default MiniProgram;