encryption
加密算法模块 模块引用方式:let encryptModule = weex.requireModule(“ums/encrypt”) 该模块包含的api如下:
encrypt(params, callback)
使用指定算法对文本进行加密
入参说明
| 属性 | 说明 |
|---|---|
| params参数 | JSON 类型 |
| text | 需要加密的文本 |
| type | 加密算法 |
| key | 加密密钥 |
回调结果
调用示例
encryptModule.encrypt({
text:”com.xxx.xxx”,
type:”AES”,
key:”xxxxxx”
},
ret => {
// 结果回调
console.log('result = ' + JSON.stringfy(ret))
});
decrypt(params, callback)
使用指定算法对文本进行解密
入参说明
| 属性 | 说明 |
|---|---|
| params参数 | JSON 类型 |
| text | 需要解密的文本 |
| type | 解密算法 |
| key | 解密密钥 |
回调结果
调用示例
encryptModule.decrypt({
text:”com.xxx.xxx”,
type:”AES”,
key:”xxxxxx”
},
ret => {
// 结果回调
console.log('result = ' + JSON.stringfy(ret))
});