I install module:
npm install --save crypto
I import it to my component:
import { createHmac } from \"crypto\";
To use crypto NodeJS library with Typescript (Angular >= 2 for example) follow these steps:
npm install @types/node --save-dev to install NodeJS definitionsIn tsconfig.ts file add the following:
"files": [
"./node_modules/@types/node/index.d.ts"
]
Import the library where you want to use it with import * as crypto from 'crypto';