-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add function $uuid() #731
base: master
Are you sure you want to change the base?
Add function $uuid() #731
Conversation
Doesn't like node 16 either (also out of service) |
Generates a random UUID (version 4) Signed-off-by: Andrew Coleman <[email protected]>
Node.js 16 went out of support last April, and was a reason for a lot of npm modules doing major version bumps through the summer as they also removed support. We should also be doing a major version bump if we're dropping support for older versions, as per semver (it's a breaking change). Node.js 18 is still in support until end of April this year, so would be reluctant to want to drop it at this point. |
I agree, and as I've just discovered, this new function was included in Node from v19. So I think we should hold off from adding this at the moment. https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto |
Would you consider writing your own uuid function, so that you don't need to use this crypto library? AFAIK, there's no actual cryptography to it, only random number generation and bitwise operators. When I first found jsonata, I implemented UUID 4 with a jsonata expression:
|
Thanks @markmelville, yes I started off with this approach, but the specification for UUIDv4 says that it should use a cryptographically secure random number generator, which led me to the https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4 |
Generates a random UUID (version 4)
Uses the crypto.randomUUID() implementation which has been available in node since v16. Hence, removing v12 & v14 from the CI (these are long out of service anyway).