2.1.0 • Published 2 years ago

miniprogram-encrypto v2.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

miniprogram-crypto

基于小程序wx.request请求,使用SM2国密插件实现接口敏感数据的加密解密。

使用此组件需要依赖小程序基础库 2.2.1 以上版本,同时依赖开发者工具的 npm 构建。具体详情可查阅官方 npm 文档

安装

npm install --save miniprogram-crypto

miniprogram-crypto

使用

需要加密的接口使用miniprogram-crypto提供的request方法请求数据

const request = require('miniprogram-encrypto').request
// 支持get和post请求
// options中除fetchPublicKeyUrl和fetchHeader,其余参数与小程序wx.request相同
interface options {
    url,
    data = {},
    method = 'GET',
    header,
    timeout = 60000,
    fetchPublicKeyUrl, // post请求时向服务器获取公钥和token的地址,get请求不传
    fetchHeader, // post请求时向服务器获取公钥和token的接口的header,可用于鉴权,get请求不传
    dataType,
    responseType,
    enableHttp2 = false,
    enableQuic = false,
    enableCache = false,
    enableHttpDNS = false,
    httpDNSServiceId,
    enableChunked = false,
    forceCellularNetwork = false
} 
request(options).then(res => {
    console.log(res); // res的值与小程序wx.request返回值相同
})

协议

MIT

2.1.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago