Created
October 14, 2025 09:02
-
-
Save widnyana/1ace934049444661a0e112ccbeb963e8 to your computer and use it in GitHub Desktop.
encrypts and decrypts text using AES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const encryptPayload = function(payload: string) { | |
| const bytes = CryptoJS.AES.encrypt(payload, process.env.API_SECRET); | |
| const value = bytes.toString(); | |
| return value; | |
| } | |
| export const decryptPayload = function(payload: string) { | |
| const bytes = CryptoJS.AES.decrypt(payload, process.env.API_SECRET); | |
| const originalValue = bytes.toString(CryptoJS.enc.Utf8); | |
| return originalValue; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment