qortal-ui/core/src/lockScreen.js

12 lines
363 B
JavaScript
Raw Normal View History

2023-06-27 17:53:44 +02:00
import CryptoJS from 'crypto-js'
2023-11-05 14:30:07 +01:00
export const encryptData = (data, salt) => CryptoJS.AES.encrypt(JSON.stringify(data), salt).toString()
2023-06-27 17:53:44 +02:00
export const decryptData = (ciphertext, salt) => {
const bytes = CryptoJS.AES.decrypt(ciphertext, salt)
try {
return JSON.parse(bytes.toString(CryptoJS.enc.Utf8))
} catch(err) {
return null
}
2023-11-05 14:30:07 +01:00
}