node.jsnpmangular5node-modules

node module - aes256 - crypto.createHash is not a function


So I have this Angular 5 application which uses aes256 library from NPM for encrypting password for login form. Inside that aes256 library, theres var crypto = require('crypto'). When I run my application and try the login form, I encountered crypto.createHash is not a function error. When I debugged my app to find out whats wrong, I see that var crypto was just an empty object. crypto.createHash is not a function crypto - empty object


Solution

  • You cannot use crypto module in angular application nor aes256 since it is build on crypto module. crypto module is a node native module you can't use any node native module from nodejs in angular application as it is running on the browser. Checkout some fronted encryption libraries here