2

I am currently developing an Ionic 4 application and need to asymmetrically encrypt a small text string, I would like to use nodejs's crypto library to call crypto.privateDecrypt and crypto.publicEncrypt.

I have tried importing the crypto library to my Ionic application by adding the following to the top of my file: import * as crypto from 'crypto'; which half does the job. But as soon as I try to run the application on my Android phone I get the following error, error TS2307: Cannot find module 'crypto'

Does anyone know how to correctly include the crypto library in Ionic 4? I assume it is just not copying across to my device as the IntelliSense works perfectly and is picking up all the methods.

Tachyon
  • 2,171
  • 3
  • 22
  • 46

0 Answers0