FluidFramework
FluidFramework copied to clipboard
Use crypto.randomUUID instead of v4 from uuid package
Description
Use crypto.randomUUID() instead of v4 from uuid package.
This API has been supported in node since 16.7: all versions of node which are not EOL support it so it should not be an issue for node users.
For client code in the browser, this is more risky. We already require crypto.subtle.digest which means we already only support Secure_Contexts, so that is not a change. This also already breaks runtimes without a crypto implementation, so that is also not a change.
randomUUID is a somewhat newer API, but its been well supported since 2021, and we only claim to support modern ES2022 era browsers. Our Current typescript lib configuration should restrict us to things we are ok with browser wise, and it already allows randomUUID.
There are two remaining usages of the uuid package both of which use it for v5 uuids:
- "@fluid-experimental/tree": only a dev dependency
- "@fluid-experimental/property-dds"
Breaking Changes
It is possible that some JavaScript runtimes without support for randomUUID will break.
Reviewer Guidance
The review process is outlined on this wiki page.
Looks like jest's "jest-environment-jsdom" library pulls in an old jsdom (version 20) which lacks the support for crypto.randomUUID which was added in 22.1.
I have added an override to mitigate this, but that makes this more of a breaking change that I would like as users cold hit the same issue when testing with Jest.
This PR has been automatically marked as stale because it has had no activity for 60 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!