Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: do not overwrite _writableState.defaultEncoding #49140

Merged

Commits on Aug 20, 2023

  1. crypto: do not overwrite _writableState.defaultEncoding

    This only affects the writable side of LazyTransform and should not
    change the behavior of any LazyTransform streams (Cipher, Decipher,
    Cipheriv, Decipheriv, Hash, Hmac).
    
    If the user does not set defaultEncoding when creating a transform
    stream, WritableState uses 'utf8' by default. Only LazyTransform
    overwrites this with 'buffer' for strict backward compatibility. This
    was necessary when crypto.DEFAULT_ENCODING still existed. Now that
    DEFAULT_ENCODING has been removed, defaultEncoding is always 'buffer'.
    The writable side of LazyTransform appears to treat 'utf8' and 'buffer'
    in exactly the same way. Therefore, there seems to be no need to
    overwrite _writableState.defaultEncoding at this point.
    
    Nevertheless, because Node.js has failed to hide implementation details
    such as _writableState from the ecosystem, we may want to consider this
    a breaking change.
    
    Refs: nodejs#47182
    Refs: nodejs#8611
    tniessen committed Aug 20, 2023
    Configuration menu
    Copy the full SHA
    1692e52 View commit details
    Browse the repository at this point in the history