'Unable To create a decipher in react-native app while it's working fine on react.js App

import crypto from 'crypto'

function decryptAes(text) {
  let key = 'some-key';
  let iv  = 'some-iv';

  let encryptedText = Buffer.from(text, 'hex');
  let decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
  let decrypted = decipher.update(encryptedText);

  decrypted = Buffer.concat([decrypted, decipher.final()]);
  return decrypted.toString();
}

I have used the above code in my react app to decrypt my server data. I have done it successfully in my react app. But this code is not running in react-native app.Hence, I am unable to decrypt my encrypted data coming from server.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source