UNPKG

wxpay-slim

Version:

微信支付轻量包,使用 ES2017 async functions 来操作微信支付,接口名称与官方接口对应,轻松上手,文档齐全

11 lines (10 loc) 231 B
const crypto = require('crypto'); /** * HMAC-SHA256签名 */ module.exports = function(key, str){ const hmac = crypto.createHmac('sha256', key); hmac.update(str); let sign = hmac.digest(); return sign.toString('hex'); };