Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

vue js encrypt localstorage data

let obj = {"studentName":"John Smith","studentId":"CSC001"};
const envryptedObject = AES.encrypt(JSON.stringify(obj),'MYKEY4DEMO');
sessionStorage.setItem('envryptedObject', envryptedObject.toString());

const decrypted2 = AES.decrypt(sessionStorage.getItem('envryptedObject'), 'MYKEY4DEMO');
const decryptedObject = decrypted2.toString(enc.Utf8);
sessionStorage.setItem('decryptedObject', decryptedObject);
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #vue #js #encrypt #localstorage #data
ADD COMMENT
Topic
Name
2+9 =