paralleldrive / cuid

Collision-resistant ids optimized for horizontal scaling and performance.
Other
3.44k stars 123 forks source link

Use crypto API in node and browser #115

Closed maxwellgerber closed 6 years ago

maxwellgerber commented 6 years ago

Addresses https://github.com/ericelliott/cuid/issues/78

In the browser we look for the crypto object or the msCrypto object. If it doesn't exist, we fall back to Math.random.

On the server we always use the crypto API.