Decrypting MSG in event subscription | XM Community
Skip to main content

Is anyone able to provide the steps necessary to decode the encrypted MSG from an encrypted event subscription?

 

Below is the code I currently have using node crypto

	const decodedMSG = Buffer.from(data.MSG, 'base64');
const iv = Buffer.alloc(16, 0)
const decipher = crypto.createDecipheriv('aes256', SECRET_KEY, iv);

let decrypted = decipher.update(decodedMSG);
;

decrypted = Buffer.concat((decrypted, decipher.final()]);
console.log(decrypted);

Some things to note:

  1. I don’t know which aes algorithm i should be using so i’m just assuming aes256
  2. I don’t know what the initialization vector is so i’m just using a buffer of 0s

Any insight to where I’m going wrong here or direction to some useful documentation would be much appreciated

 

Be the first to reply!

Leave a Reply