Occasionally there is a time where you have sensitive data...but not that sensitive :)
It's data that could be viewable if you start sniffing around casually and you're looking to prevent that.
WARNING This shouldn't be used on passwords, credit cards, and anything similar that should be fully protected. This could be reversed engineered and decoded by someone patient and savvy enough.
With that said, here's a take on securing data to and from client and server as well as store it encrypted on the client.
Using AES encryption here, but could be any symmetric encryption type such as DES, Blowfish, Twofish, RC6, etc.
This is based on CryptoJS: https://github.com/brix/crypto-js https://code.google.com/archive/p/crypto-js/