I am adding a class with constructor in Fabcar.js and trying to create object for the class and call the constructor with new key word. But i am getting error like below.
" Failed to evaluate transaction: Error: key is not defined "
This is the code written in fabcar.js
const AES = class {
constructor(key) {
if (!(this instanceof AES)) {
throw Error('AES must be instanitated with `new`');
}
Object.defineProperty(this, 'key', {
value: this.callMethod(key, true)
});
this._prepare();
}
};
class FabCar extends Contract {
async createDonorRegDetails(ctx,arg1,arg2) {
// other code here
var key = [
84, 104, 97, 116, 115,
32, 109, 121, 32, 75,
117, 110, 103, 32, 70,
117
];
var aes = new AES(key);
}
}
module.exports = FabCar;