Language: JavaScript
Label: safe
CWE: CWE-331 \u2014 Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.

Code:
    NodeCryptography.prototype.encryptStream = function (key, stream) {
        return __awaiter(this, void 0, void 0, function () {
            var bIv, aes, inited;
            return __generator(this, function (_a) {
                bIv = this.getIv();
                aes = (0, crypto_1.createCipheriv)('aes-256-cbc', key, bIv).setAutoPadding(true);
                inited = false;
                return [2 /*return*/, stream.pipe(aes).pipe(new stream_1.Transform({
                        transform: function (chunk, _, cb) {
                            if (!inited) {
                                inited = true;
                                this.push(Buffer.concat([bIv, chunk]));
                            }
                            else {
                                this.push(chunk);
                            }
                            cb();
                        },
                    }))];
            });
        });
    };