npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wxbizmsgcrypt

v1.0.6

Published

wechat open platform message crypt solution for nodejs

Downloads

7

Readme

WxBizMsgCrypt-NodeJs

NodeJs的微信开放平台消息加解密方案
test

开发背景

NodeJs经过几年的发展,可以说在高并发,高实时性的应用中还是占有一席之地的。拿微信开放平台来说,如果接入消息管理的公众号比较多,而需要保持低延迟响应的话,NodeJs的优势可以说是非常明显的。
但是微信开放平台官网并没有提供NodeJs的开发包,所以开发了本程序。

使用方法[JS]

npm install wxbizmsgcrypt --save
  • 消息体加密
var WxBizMsgCrypt = require('wxbizmsgcrypt').WxBizMsgCrypt;
var wxbizmsgcrypt = new WxBizMsgCrypt(token,encodingAesKey,appId);
console.log(wxbizmsgcrypt.encryptMsg('待加密文本','时间戳','随机字符串'));
  • 消息体解密(由于使用的xml2js库来解析XML文档,而xml2js解码时使用了回调函数,故本程序在解码XML时使用了Promise包装)
var WxBizMsgCrypt = require('wxbizmsgcrypt').WxBizMsgCrypt;
var wxbizmsgcrypt = new WxBizMsgCrypt(token,encodingAesKey,appId);
wxbizmsgcrypt.decryptMsg('msg_signature','时间戳','随机字符串','加密的XML').then(function(xml) {
  console.log(xml);
});

使用方法[TS]

  • 消息体加密
import {WxBizMsgCrypt} from 'wxbizmsgcrypt';
const wxbizmsgcrypt = new WxBizMsgCrypt(token,encodingAesKey,appId);
console.log(wxbizmsgcrypt.encryptMsg('待加密文本','时间戳','随机字符串'));
  • 消息体解密
import {WxBizMsgCrypt} from 'wxbizmsgcrypt';
const wxbizmsgcrypt = new WxBizMsgCrypt(token,encodingAesKey,appId);
wxbizmsgcrypt.decryptMsg('msg_signature','时间戳','随机字符串','加密的XML').then(function(xml) {
  console.log(xml);
});