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: move Hmac and Hash constructor to eol #53026

Closed

Conversation

marco-ippolito
Copy link
Member

@marco-ippolito marco-ippolito commented May 16, 2024

Removes the public constructor of Hash and Hmac

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels May 16, 2024
@marco-ippolito marco-ippolito added deprecations Issues and PRs related to deprecations. semver-major PRs that contain breaking changes and should be released in the next major version. needs-citgm PRs that need a CITGM CI run. labels May 16, 2024
@marco-ippolito marco-ippolito changed the title crypto: move Hmac constructor to eol crypto: move Hmac and Hash constructor to eol May 18, 2024
@marco-ippolito marco-ippolito marked this pull request as ready for review May 18, 2024 11:16
@tniessen
Copy link
Member

tniessen commented May 18, 2024

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
Copy link
Member Author

marco-ippolito commented May 18, 2024

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem. deprecations Issues and PRs related to deprecations. needs-ci PRs that need a full CI run. needs-citgm PRs that need a CITGM CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants