oculus42 / short-uuid

Translate standard UUIDs into shorter formats and back.
MIT License
450 stars 13 forks source link

Is it possible to make short-uuid translate with firebase UIDs? #64

Closed emmaalecrim closed 2 years ago

emmaalecrim commented 2 years ago

Hi i was looking for a project that could make it possible to translate firebase UIDs to shorter versions and stumbled here, but after testing I discovered that it doesn't seem to support that different id spec. Is there any alphabet that could be used to make them compatible or would the way the translation is implemented make it impossible?

I get the following error and variations of it when trying to convert a firebase UID to a shorter version, but I don't really know what It means. Any help or information on this would be an amazing, thanks! If any further information to help answer this is required please let me know and I'll try to be more descriptive if necessary. Error: Error: Number "AZo9YE9SfBYkGaD3JPXl10jHtYC2" contains of non-alphabetic digits (1234567890abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ)

wparad commented 2 years ago

short-uuid doesn't make things shorter, it just changes the character base. uuids are in a base16, this library only converts them from base16 to base62 or base90 (or whatever you want). The firebase UID is already base62. If you want to make it shorter you'll need to compute the change base yourself. Although base62 already produces a quite short representation, I can't fathom the benefit of trying to use a higher base.

If you really want to create a shorter representation, you can easily look at the source and compute the change base yourself, right?

emmaalecrim commented 2 years ago

Yeah, I imagined it being this way. Yeah, I could change it myself but I'll check if it even makes any sense to(for future reference, I've already began implementing 8 char ids mapped to the firebase id as converting the UID to a shorter thing while preserving the info didn't seem fruitful). Thanks for the help!

emmaalecrim commented 2 years ago

Forgot to close :)