I am getting error's in my file called PasswordDecrypt.ts
This is the Error:
error TS2339: Property 'createDecipheriv' does not exist on type 'Crypto'.
error TS2304: Cannot find name 'iv'.
PasswordDecrypt.ts
var crypto = require('crypto'),
algorithm = 'sed-ded-xby',
password = new Buffer('xxxxxxxxxx', 'utf-8');
iv = new Buffer('L4i/N0z6qx9=', 'base64');
var decr = function decrypt(text){
var encrypted = new Buffer(text, 'base64');
var decipher = crypto.createDecipheriv(algorithm, password, iv);
var decoded = decipher.update(encrypted, 'binary', 'ascii');
decoded += decipher.final('ascii');
return decoded;
}
module.exports.decr = decr;
package.json
{
"name": "lambdats",
"version": "0.0.0",
"description": "LambdaTS",
"main": "app.js",
"author": {
"name": "",
"email": "abc@xyz.com"
},
"scripts": {
"build": "gulp clean && gulp compile && gulp node-mods",
"deploy": "gulp clean && gulp zip"
},
"devDependencies": {
"babel-plugin-transform-runtime": "^6.4.3",
"babel-preset-es2015": "^6.3.13",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.1",
"gulp-install": "^0.6.0",
"gulp-mocha": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.10.0",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.0.2",
"lambda-local": "0.0.6",
"node-aws-lambda": "^0.1.7",
"run-sequence": "^1.1.5"
},
"dependencies": {
"@types/crypto-js": "^3.1.44",
"aws-lambda": "0.0.14",
"aws-sdk": "^2.661.0",
"aws-secrets-manager": "^1.1.0",
"babel-runtime": "^5.3.0",
"chai": "^3.5.0",
"cheerio": "^0.19.0",
"crypto": "^1.0.1",
"guid": "0.0.12",
"lodash": "^4.0.0",
"minimatch": "^3.0.3",
"mocha": "^2.4.5",
"mssql": "^4.0.4",
"node-connection-string-builder": "^0.0.1",
"pug": "^2.0.0-beta11",
"tedious": "^2.0.1"
}
}
I believe Crypto is a built in module. Then why i am not able to use it.
Kindly help me with this.