summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/cipher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/crypto/cipher.ts')
-rw-r--r--ext/node/polyfills/internal/crypto/cipher.ts24
1 files changed, 22 insertions, 2 deletions
diff --git a/ext/node/polyfills/internal/crypto/cipher.ts b/ext/node/polyfills/internal/crypto/cipher.ts
index d40978cf6..670c1bcce 100644
--- a/ext/node/polyfills/internal/crypto/cipher.ts
+++ b/ext/node/polyfills/internal/crypto/cipher.ts
@@ -129,7 +129,17 @@ export class Cipheriv extends Transform implements Cipher {
iv: BinaryLike | null,
options?: TransformOptions,
) {
- super(options);
+ super({
+ transform(chunk, encoding, cb) {
+ this.push(this.update(chunk, encoding));
+ cb();
+ },
+ final(cb) {
+ this.push(this.final());
+ cb();
+ },
+ ...options,
+ });
this.#cache = new BlockModeCache(false);
this.#context = ops.op_node_create_cipheriv(cipher, key, iv);
}
@@ -235,7 +245,17 @@ export class Decipheriv extends Transform implements Cipher {
iv: BinaryLike | null,
options?: TransformOptions,
) {
- super(options);
+ super({
+ transform(chunk, encoding, cb) {
+ this.push(this.update(chunk, encoding));
+ cb();
+ },
+ final(cb) {
+ this.push(this.final());
+ cb();
+ },
+ ...options,
+ });
this.#cache = new BlockModeCache(true);
this.#context = ops.op_node_create_decipheriv(cipher, key, iv);
}