dylanhart / ulid-rs

This is a Rust implementation of the ulid project
https://crates.io/crates/ulid
MIT License
389 stars 37 forks source link

Expose base32 implementation? #63

Closed beanow-at-crabnebula closed 1 year ago

beanow-at-crabnebula commented 1 year ago

I had a look at #34 and ran into kind of the opposite situation.

Thanks for this crate :] currently using it for a number of ID fields. However I ran into a case where I wanted to use the underlying base32 directly: JTIs.

When we're talking about a JWT we already have access to a timestamp (iat). And so using ULIDs would make the timestamp data redundant.

Base32 encoding for 128 bits of data however is plenty sound! So I thought about using the underlying base32 implementation and here we are.

beanow-at-crabnebula commented 1 year ago

Note: keep it as a low priority suggestion :] I came up with an alternative format already being used as a dependency: base64url. They're JWTs after all :joy:

dylanhart commented 1 year ago

Copy-paste it if you want; it's licensed under MIT. I'm not personally interested in packaging it independently. Do be warned that the base32 representation is technically 130 bits that then get truncated into a u128.