Support native `randomUUID()`
piranna opened this issue · 6 comments
Starting on Node.js 15.6, there's support for a native randomUUID()
implementation, that implements UUID v4. What about checking for its support on https://github.com/uuidjs/uuid/blob/master/src/v4.js and use it when available?
It's certainly on my list but I'm not sure if and when I'll manage to work on it. But happy to review a pull request if you are interested in working on it.
Following the discussion in #555 I think we could provide maybe even more value by providing an actual polyfill-package for the new API which works both, in Node.js and in the browser. For this purpose we've created https://github.com/uuidjs/randomUUID and reserved the npm package name: https://www.npmjs.com/package/randomuuid
As a big disclaimer I have to say though that I can't tell when I will find the time to personally work on that. If you want, feel free to give it a try contribute to it!
Following the discussion in #555 I think we could provide maybe even more value by providing an actual polyfill-package for the new API which works both, in Node.js and in the browser. For this purpose we've created uuidjs/randomUUID and reserved the npm package name: npmjs.com/package/randomuuid
Interesting aproach, definitely would be useful at least for my use case (I'm a bit TOC about using w3c or browsers APIs if possible). We can just copy Node.js implementation, and do two polyfills, one for Node.js crypto
module using require()
(not sure how we could do it with ESM import
s) and another for browser. Main problem would be SecureBuffer()
function since it's a native one, but for a first PoC implementation, although less secure, we could omit it. How do you see it?
Following the discussion in #555 I think we could provide maybe even more value by providing an actual polyfill-package for the new API which works both, in Node.js and in the browser. For this purpose we've created uuidjs/randomUUID and reserved the npm package name: npmjs.com/package/randomuuid
I have done a first implementation in uuidjs/randomUUID#1 based on code from Node.js. It works and have tests, but lacks documentation.