Decrypt the given encrpted data using AES-256-GCM alogirthm with key and IV

const _crypto = require(‘crypto-js’);

const decryptAes256Gcm = (encdata) => {
try {
// base64 decoding
const bData = Buffer.from(encdata, ‘base64’);
// convert data to buffers
const iv = 12;
const tag = bData.slice(80, 96);
const text = bData.slice(96);
// derive key using; 32 byte key length
const key = ‘fgrtheForbtgkpeNQ4MM0+LvfEdj1MUh8/gjh5Ur0=’ ;
// AES 256 GCM Mode
const decipher = _crypto.createDecipheriv(‘aes-256-gcm’, key, iv);
decipher.setAuthTag(tag);
return decipher.update(text, ‘binary’, ‘utf8’) + decipher.final(‘utf8’)
} catch (err) {
return err
}
}
// ======================== //////// ==========================

const encryptedData = ‘"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwa2dKMkhsenpudDhLWEkyMH’;
console.log(‘decrypted data ->’, decryptAes256Gcm(encryptedData))