Giraffe.TokenRouter icon indicating copy to clipboard operation
Giraffe.TokenRouter copied to clipboard

Support for short GUIDs

Open danieljsummers opened this issue 5 years ago • 3 comments

I attempted to use a short GUID with the token router, and it didn't like it. I checked, and sure enough, this one doesn't support it - yet. Would you entertain a PR for it?

My thought was to check in the GUID parsing logic to see if the captured length was 22 characters, and if so, run it through ShortGuid.toGuid. It may not be the most efficient way to do it (I imagine there's a reason it doesn't use Guid.TryParse on the chunk of captured data), but it would provide support for the format.

It might not be too tough to parse through it in chunks of 4 characters, and grab the bits from there via a lookup table. The lookup table part makes me wonder how efficiently it could be done. I'm definitely not too strong with bit-shifting.

Anyway, let me know. I don't know that I could turn it really quick, but I think it wouldn't take too long.

danieljsummers avatar Feb 23 '19 03:02 danieljsummers