完整文档请查阅: API 完整文档
# 使用pnpm
$ pnpm i node-wxcrypto
# 使用yarn
$ yarn add node-wxcrypto
# 使用npm
$ npm i node-wxcrypto --save
require 引入
const { WxCrypto } = require('node-wxcrypto')
/**
* class WxCrypto
*
* @param {string} token token
* @param {string} aesKey 43位
* @param {string} appID appID
* @return {Object} WxCrypto instance
*/
const wxCrypto = new WxCrypto(token, aesKey, appID)
/**
* decrypt data
*
* @param {string} encrypt encrypt data
* @param {string} timestamp timestamp
* @param {string} nonce nonce
* @return {Object} decrypt data
*/
const data = await wxCrypto.decrypt(encrypt, timestamp, nonce)
import 引入
import { WxCrypto } from 'node-wxcrypto'
/**
* class WxCrypto
*
* @param {string} token token
* @param {string} aesKey 43位
* @param {string} appID appID
* @return {Object} WxCrypto instance
*/
const wxCrypto = new WxCrypto(token, aesKey, appID)
/**
* decrypt data
*
* @param {string} encrypt encrypt data
* @param {string} timestamp timestamp
* @param {string} nonce nonce
* @return {Object} decrypt data
*/
const data = await wxCrypto.decrypt(encrypt, timestamp, nonce)
Please open an issue here.