I am using aes-js library to test AES encryption . When I try to decrypt a ciphertext, I am getting the following error
Error: unsupported array-like object at coerceArray (/data/data/com.suspendresume/files/nodejs-project/node_modules/aes-js/index.js:51:15) at new ModeOfOperationCBC (/data/data/com.suspendresume/files/nodejs-project/node_modules/aes-js/index.js:442:33) at MyEmitter.rn_bridge.channel.on (/data/data/com.suspendresume/files/nodejs-project/main.js:76:15) at emitOne (events.js:115:13) at MyEmitter.emit (events.js:210:7) at Immediate.setImmediate [as _onImmediate] (/data/data/com.suspendresume/files/nodejs-builtin_modules/rn-bridge/index.js:14:13) at runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5)
The following is my code
encryptedHex ='yRe2x6Gf2uVzfesp1I7ISkkAjTo2xoH2SPSqXzdWKHg+HhosYblfTFUJVoPVgpyf'
iv= 'ec8902010adc3d63';
key='aa54c24fae5e52a5861c80f466a90922'
key= aesjs.utils.hex.toBytes(key)
// When ready to decrypt the hex string, convert it back to bytes
var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex);
// The cipher-block chaining mode of operation maintains internal
// state, so to decrypt a new instance must be instantiated.
var aesCbc = new aesjs.ModeOfOperation.cbc(key, iv);
var decryptedBytes = aesCbc.decrypt(encryptedBytes);
// Convert our bytes back into text
var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes);
console.log(decryptedText);
Please help me to solve this problem