graphql-scalars icon indicating copy to clipboard operation
graphql-scalars copied to clipboard

Add CUID scalar type

Open haleksandre opened this issue 3 years ago • 1 comments

Could it be possible to add a cuid scalar type.

cuid

cjld2cyuq0000t3rmniod1foy

Broken down

 c - h72gsb32 - 0000 - udoc - l363eofy

The groups (in order)

  • 'c' - identifies this as a cuid, and allows you to use it in html entity ids.
  • Timestamp
  • Counter - a single process might generate the same random string. The weaker the pseudo-random source, the higher the probability. That problem gets worse as processors get faster. The counter will roll over if the value gets too big.
  • Client fingerprint
  • Random (using cryptographically secure libraries where available).

More info

https://github.com/ericelliott/cuid

haleksandre avatar Mar 11 '21 23:03 haleksandre

That sounds cool! Would you create a draft PR for that so we can help you in advance?

ardatan avatar Mar 12 '21 00:03 ardatan