feat: 登录时,对用户名密码加密

This commit is contained in:
taojinlong
2021-10-25 15:36:51 +08:00
parent 042f447286
commit 1ef965357d
8 changed files with 35 additions and 253 deletions

View File

@@ -16,6 +16,7 @@ const privateKey = 'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdb
// 加密
export function encrypt(txt) {
let publicKey = localStorage.getItem("publicKey");
const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
@@ -28,3 +29,4 @@ export function decrypt(txt) {
return encryptor.decrypt(txt)
}