UNPKG

socket.io-react-hooks-advanced

Version:

A modular and extensible React + Socket.IO hook library designed for real-world applications. Supports namespaced sockets, reconnection strategies, offline queues, latency monitoring, middleware, encryption, and more.

9 lines (8 loc) 324 B
import CryptoJS from "crypto-js"; export const encryptAES = (plaintext, secretKey) => { return CryptoJS.AES.encrypt(plaintext, secretKey).toString(); }; export const decryptAES = (ciphertext, secretKey) => { const bytes = CryptoJS.AES.decrypt(ciphertext, secretKey); return bytes.toString(CryptoJS.enc.Utf8); };