From 1e2b8290d84b62cee11bf2638a3cca6df88bd613 Mon Sep 17 00:00:00 2001 From: larabr <7375870+larabr@users.noreply.github.com> Date: Thu, 13 Nov 2025 15:13:28 +0100 Subject: [PATCH] Internal: use transformAsync over transform with async callbacks --- src/crypto/cipherMode/cfb.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/cipherMode/cfb.js b/src/crypto/cipherMode/cfb.js index 5d4c379f..12174d5d 100644 --- a/src/crypto/cipherMode/cfb.js +++ b/src/crypto/cipherMode/cfb.js @@ -24,7 +24,7 @@ import { cfb as nobleAesCfb, unsafe as nobleAesHelpers } from '@noble/ciphers/aes'; -import { transform as streamTransform } from '@openpgp/web-stream-tools'; +import { transform as streamTransform, transformAsync as streamTransformAsync } from '@openpgp/web-stream-tools'; import util from '../../util'; import enums from '../../enums'; import { getLegacyCipher, getCipherParams } from '../cipher'; @@ -351,10 +351,10 @@ class NobleStreamProcessor { async function aesEncrypt(algo, key, pt, iv) { if (webCrypto && await WebCryptoEncryptor.isSupported(algo)) { // Chromium does not implement AES with 192-bit keys const cfb = new WebCryptoEncryptor(algo, key, iv); - return util.isStream(pt) ? streamTransform(pt, value => cfb.encryptChunk(value), () => cfb.finish()) : cfb.encrypt(pt); + return util.isStream(pt) ? streamTransformAsync(pt, value => cfb.encryptChunk(value), () => cfb.finish()) : cfb.encrypt(pt); } else if (util.isStream(pt)) { // async callbacks are not accepted by streamTransform unless the input is a stream const cfb = new NobleStreamProcessor(true, algo, key, iv); - return streamTransform(pt, value => cfb.processChunk(value), () => cfb.finish()); + return streamTransformAsync(pt, value => cfb.processChunk(value), () => cfb.finish()); } return nobleAesCfb(key, iv).encrypt(pt); } @@ -362,7 +362,7 @@ async function aesEncrypt(algo, key, pt, iv) { function aesDecrypt(algo, key, ct, iv) { if (util.isStream(ct)) { const cfb = new NobleStreamProcessor(false, algo, key, iv); - return streamTransform(ct, value => cfb.processChunk(value), () => cfb.finish()); + return streamTransformAsync(ct, value => cfb.processChunk(value), () => cfb.finish()); } return nobleAesCfb(key, iv).decrypt(ct); }