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

legacy nodejs compatibility: getRandomBytes #94

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented Aug 29, 2024

  • fix: support randomBytes for older Node.js versions
    • crypto.getRandomValues is only available on Node.js versions v17+.
    • crypto.randomBytes provides the same API as randomBytes, with the same randomness guarantees as crypto.getRandomValues.
    • This makes the implementation runtime compatible with Node.js v12 and v14.
  • github ci: add supported nodejs v16 to test matrix
    • Adds coverage for already supported version
  • github ci: add legacy nodejs v14 to test matrix
    • Figuring that even if it's not officially supported, it could be relevant to monitor compatibility in CI?
    • v12 is not compatible with the used version of typescript so can not build.

Related

@legobeat legobeat changed the title legacy node compat legacy nodejs compatibility: getRandomBytes Aug 29, 2024
@legobeat legobeat marked this pull request as ready for review August 29, 2024 00:11
@paulmillr
Copy link
Owner

V16 is also not officially supported by node. Only v18 is

@paulmillr paulmillr merged commit 96a2ea7 into paulmillr:main Aug 29, 2024
5 checks passed
This was referenced Aug 29, 2024
@legobeat
Copy link
Contributor Author

V16 is also not officially supported by node. Only v18 is

For sure! But that's a different question to which versions can be used with @noble/hashes right?

(BTW: For example Debian still maintains security updates down to v12, even actively supported Ubuntu 20.04 LTS is still on v10. Enterprise Linux vendors like RedHat and SUSE also typically provide support for older versions regardless of upstream maintainer schedules. So continued use of older Node.js majors beyond the official support windows is not necessarily deprecated per se)

@paulmillr
Copy link
Owner

I think we can support any version/platform which is not pain in the ass. E.g. if it's just 2 lines of code then it's cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants