How to Encrypt data in React native (Using Expo)

后端 未结 4 1446
梦如初夏
梦如初夏 2021-01-22 19:53

I\'m trying to simply encrypt a message using a given key and iV. I\'ve tried several libraries to achieve this but Expo isn\'t compatible with any of them. I couldn\'t find any

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 20:56

    Use crypto-js@3.1 , 3.1.x version use Math.random() and doesn't require node "crypto" package. It's not as safe as the latest version but works for me.

    yarn add crypto-js@3.1 
    

    I only use it for decrypting. If you really need it for some security requirements I suggest you encrypt it in server node enviroment.

提交回复
热议问题