UNPKG

@fruitsjs/crypto

Version:

Cryptographic functions for building Fruits Eco-Blockchain apps.

14 lines (12 loc) 408 B
import * as CryptoJS from 'crypto-js'; /** * Symmetrically encrypts a text using an arbitrary key * @see [[decryptAES]] * @param text The message/text to be encrypted * @param key The key used * @return The encrypted message as Base64 string * @module crypto */ export const encryptAES = (text: string, key: string): string => { return CryptoJS.AES.encrypt(text, key).toString(); };