import * as crypto from 'crypto';
import * as buffer from 'buffer';
let key = buffer.from("***********9");
let nonce = buffer.from("********2");
let plainText = buffer.from('****');
let cipher = crypto.createCipher(crypto.Algorithm.AES_GCM, key, { nonce: nonce });
let cipherText = cipher.encrypt(plainText);
console.log(cipherText.toString(buffer.Encoding.Base64));
Creating Symmetric Encryption Objects