Skip to content

Do we still need the uuid library? #735

Answered by broofa
max-programming asked this question in Q&A
Discussion options

You must be logged in to vote

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…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@max-programming
Comment options

@Motii1
Comment options

@broofa
Comment options

Answer selected by broofa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #734 on September 21, 2023 12:13.