How to decrypt Apple Business Chat attachment?

Hello,

i am integrating with apple business chat api with product write in nodeJS. Among these avenues is the need to manage voice messages sent from the chat to my configured webhook.

the steps I take are:
  • reading the webhook and calling the API / preDownload

  • once I get the url I make a get and I get the decrypted file. below the request and my actual attempt to decrypt the content

Code Block
return request({
"method": "GET",
"uri": resp["download-url"],
"timeout": 10000
});
})
.then((content) => {
const iv = Buffer.alloc(16,0);
const key = attachment.key.slice(2);
let image = CryptoJS.AES.decrypt(Buffer.from(content, 'binary').toString('binary'), key, {
mode: CryptoJS.mode.CTR,
iv: iv,
padding: CryptoJS.pad.NoPadding
});
return image;
})


I'm having a number of problems decrypting the file.

Has anyone encountered the same problem? Could you help me understand what I'm doing wrong?

Thank you
Did you find a solution for this I am stuck on it too.
no I'm sorry, I threw in the towel. I have tried other attempts without getting out of it
How to decrypt Apple Business Chat attachment?
 
 
Q