A straightforward form of encryption using a passphrase (or a shared secret) that can be useful in web-based environments - especially in storage and transport. Consider e.g. securing sensitive user data in localStorage
, or sending data via a third-party server (such as a serverless endpoint).
This method uses a passphrase to encrypt and decrypt any string
, number
, array
, or other JSON-compatible object
using AES in GCM mode and is ideal for cases where one party is both encrypting and decrypting. For cases where you are sending encrypted data to other parties you might consider alternative methods, such as public-key cryptography. For a comprehensive rundown of encryption me