Do we still need the uuid
library?
#735
-
First off, amazing library and thank you for keeping this alive. But I recently discovered that So do we still need this library? If we don't, what tools don't support the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
tl;dr: If all you need is a version 4 UUID (random) and you only care about modern platforms, then
That said ... One caveat to be aware of is that because it's a new standard it is subject to the "secure context only" policy. So it won't work in non-secure contexts (i.e. web pages served in production via HTTP rather than HTTPS). See explanation of "secure context"
|
Beta Was this translation helpful? Give feedback.
tl;dr: If all you need is a version 4 UUID (random) and you only care about modern platforms, then
randomUUID()
is the way to go.crypto.randomUUID()
is a relatively new standard. It is now broadly supported, so shouldn't be an issue for most users.That said ...
One caveat to be aware of is that because it's a new standard it is subject to the "secure context only" policy. So it won't work in non-secure contexts (i.e. web pages served in production via HTTP rather than HTTPS). See explanation of "secure context"
randomUUID()
also only provides "version 4" (random) UUIDs. If you want one of the other flavors of UUID (there are 5 officially, soon to be 8), you'll still need a 3rd party sol…