Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.check = checkNative(this.type, this.algo, this.curve).then(function (answer) {
_this.checking = false;
if (answer) {
_this.hasNative = true;
} else {
_this.hasNative = false;
var algo = normalize(_this.algo, true);
if (_this.curve) {
_this.nodeCrypto = createHash(algo);
} else if (_this.other) {
_this.nodeCrypto = sign.createVerify('RSA-' + algo);
} else {
_this.nodeCrypto = sign.createSign('RSA-' + algo);
}
if (_this._cache && _this._cache.length) {
_this._cache.forEach(function (thing) {
_this.nodeCrypto.update(thing);
});
_this._cache = null;
}
}
});
}