hapijs / yar

A hapi session manager
Other
133 stars 59 forks source link

Use built-in crypto.randomUUID #156

Closed jonathansamines closed 2 years ago

jonathansamines commented 3 years ago

Support plan

Context

What problem are you trying to solve?

Yar makes use of uuid.v4(). Given that dropping support for Node 12 is being proposed at https://github.com/hapijs/hapi/issues/4279. Is it worth considering to use the Node's built-in support for UUID v4 (crypto.randomUUID)?

Do you have a new or modified API suggestion to solve the problem?

Not necessary, change would be an implementation detail, but support for Node 12 must be dropped. It is also worth mentioning that crypto.randomUUID is only available from Node 14.17

kanongil commented 3 years ago

I think it makes sense to require node 14.17+. It has been out for close to 5 months, and likely more than 6 once this change would be published. Hapi is already known for aggressive node runtime requirements.

Nargonath commented 3 years ago

It would make sense indeed. Thanks @jonathansamines for raising this. Usually it's pretty straightforward for users to increase their minor/patch versions of Node so I'd expect this version requirements not to be pretty problematic. We'd have to flag it breaking changes though since we're dropping Node@12 by using it.