Skip to content

saqqdy/node-wxcrypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e4d8159 · Jan 16, 2023

History

30 Commits
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Nov 16, 2022
Nov 16, 2022
Jan 16, 2023
Nov 16, 2022
Nov 16, 2022
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Nov 16, 2022
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Nov 16, 2022
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023
Jan 16, 2023

Repository files navigation

node-wxcrypto

微信消息加解密 nodejs 版本

NPM version Codacy Badge build status Test coverage License

Sonar

完整文档请查阅: 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.

License

MIT