I need store the secure information in AsyncStorage ,
所以请任何人解释如何在react native中加密和解密文本
I need store the secure information in AsyncStorage ,
所以请任何人解释如何在react native中加密和解密文本
您可以使用crypto js library https://github.com/brix/crypto-js.在React原生应用程序中运行良好.
npm install crypto-js --save
var CryptoJS = require("crypto-js");
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123');
console.log("encrypted text", ciphertext.toString());
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123');
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
console.log("decrypted text", plaintext);