Live data from Hacker News

Making Beautiful API Keys

docs.agentstation.ai

81–90 of 107 posts

Re: Making Beautiful API Keys

#82
post #2

One of the best things you can do to your API key is to give it a fixed prefix. Makes it very easy to tell that you have the right string, to detect accidental secret leakage, etc... IMHO this makes key much more beautiful than any internal structure.

actual functional features in API keys! How dare you! aesthetics over all!!

Re: Making Beautiful API Keys

#83

Earlier quoted context omitted.

Crockford has a checksum though

https://github.com/agentstation/uuidkey/blob/master/uuidkey.... They don't appear to check validity though? I haven't tested it so maybe someone else can double check.

yes they do. We use it in prod

Re: Making Beautiful API Keys

#84

This type of key editing always makes me nervous. I know how uuids behave. I'm not a security expert, but I'm 99% sure the formatting steps here don't increase the chance of key collisions or security implications significantly. Is that 1% risk worth it?

I agree - the reformatted IDs are shorter than the originals, so by the pigeonhole principle you are increasing the chance of collision.

I doubt this matters in reality for this case, but the number of comments stating "there is no difference" or something to this effect shows how any added step can easily be misunderstood and could (in the worst case) introduce a fatal security flaw.

Re: Making Beautiful API Keys

#85

Earlier quoted context omitted.

They use Crockford Base32 encoding which does exactly that.

I don't think so since the sample key they present in the big image contains many of these. The caption is "An example API key generated by github.com/gofrs/uuid and encoded with github.com/agentstation/uuidkey." - so something is wrong.

You need to look harder at the encoding standard. After generation all o are mapped to 0 and all l are mapped to 1 so yes there are 0 and 1 but there are never o and l.

Re: Making Beautiful API Keys

#88
> uppercase letters and numbers for "blocky" aesthetics and readability

I'm not sure if this is meant to be read as "uppercase (letters and numbers)", but it is effectively what he's referring to.

Lowercase digits do exist[1], but there's no Unicode encoding for them and fonts typically have to choose to support one or the other.

[1]: https://en.wikipedia.org/wiki/Text_figures

Re: Making Beautiful API Keys

#90
I'm not sure whether the result is more readable than a UUID. With a UUID you at least know that it can only be [0-9A-F]. Besides, who on earth _types_ API keys? You should copy/paste them and store them in a password manager. So they don't _need_ to be readable.
Post reply on HN