uni-app中使用jsencrypt

1.在工具栏的”视图“下打开终端或者ctrl+`
2.安装jsencrypt ,安装的东西都会在node_module下

npm i jsencrypt

3.在需要加密的文档中引入

import JSEncrypt from '../../node_modules/jsencrypt/bin/jsencrypt.js'

4.js部分

**加密**
var encrypt = new JSEncrypt();
let publicKye ="";
encrypt.setPublicKey(""); // 公钥
let aa = encrypt.encrypt('1234567'); // password console.log(aa)

var decrypt = new JSEncrypt();
let privateKey =""
decrypt.setPrivateKey(privateKey);
let decryption = decrypt.decrypt(aa);
console.log(decryption);
 
posted @ 2022-09-18 15:16  三瑞  阅读(1562)  评论(0编辑  收藏  举报