alexzorin / authy

Go library and program to access your Authy TOTP secrets.
MIT License
800 stars 58 forks source link

Add Locale Detection #4

Closed kmpoppe closed 4 years ago

kmpoppe commented 4 years ago

Added Locale Detection to QueryAuthenticatorApps-function. Also appended the query parameters, even though the call seems to work perfectly without them.

@alexzorin Thanks for providing this feature in the first place, where you had little intention yesterday. Much appreciated! When I checked, the query parameters where missing, so I guessed that would be nice. As I'm from Germany, my locale entry was different, so the current locale is now requested via jibber_jabber.

If you feel this contribution is unnecessary, feel free to close this PR.

// Kai

kmpoppe commented 4 years ago

In hindsight... Did you POST the request instead of GETting it? That would explain why I didn't see them in AUTHY_DEBUG ... God it's early.

alexzorin commented 4 years ago

Yes, the parameters are part of the POST body and do not need to be included in the URL. This matches what the official client does. The validation in Authy's APIs is rather haphazard.

With locale, does it make any material difference in the end if we send en-GB instead of a true locale? The name of the token is "Twitch" regardless of language, right? The parameter is only included to mimic the official client's behavior. I certainly would not want to drag in an external dependency unless it is really needed.

kmpoppe commented 4 years ago

I honestly can't tell, obvs. Twitch has no other name, I guess that Authy just has the capability to give companies different languages. If you, understandably, don't want to add another dependency, there was also a way to get the locale just through Linux/Windows-style methods (either ENV-something or powershelling), that would have the same result but without an outside lib.

alexzorin commented 4 years ago

I agree. If it turns out that locale actually does something, that's what we can do. Since we're dealing with people's security credentials, keeping the code small is ideal. I think this can be closed for now, but you have my thanks.