nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
104.75k stars 28.29k forks source link

crypto: move Hmac and Hash constructor to eol #53026

Closed marco-ippolito closed 3 weeks ago

marco-ippolito commented 4 weeks ago

Removes the public constructor of Hash and Hmac

nodejs-github-bot commented 4 weeks ago

Review requested:

tniessen commented 3 weeks ago

I haven't been following these deprecations — how do users do runtime type checks now?

For reference, when I added KeyObject, the constructor was intentionally not exposed. Later, users requested that it be exposed, primarily for type checking. (It still cannot be instantiated using the public constructor, though.)

marco-ippolito commented 3 weeks ago

I haven't been following these deprecations — how do users do runtime type checks now?

For reference, when I added KeyObject, the constructor was intentionally not exposed. Later, users requested that it be exposed, primarily for type checking. (It still cannot be instantiated using the public constructor, though.)

Duck typing, at least this is what has been suggested for fs classes like fs.Stats. Issue is that we are exposing the old constructor without new keyword and it prevents refactoring to es6 classes. I'm working on the refactor in a follow up pr I'm not against leaving it for type cheking but prevent it from being instanciated

marco-ippolito commented 3 weeks ago

now that I think about it, we can avoid removing it completely, closing I'll do it in a follow up