dgryski / dgoogauth

Google Authenticator for Go
426 stars 59 forks source link

handle errors, add ProvisionURIWithIssuer method #1

Closed mna closed 10 years ago

mna commented 10 years ago

Hi Damian,

The major change is the addition of ProvisionURIWithIssuer method, that respects the recommendations found here: https://code.google.com/p/google-authenticator/wiki/ConflictingAccounts

It's an addition so that existing code does not break, and the current ProvisionURI returns the same values as before (I added a test to validate before and after the change).

Smaller changes: return an invalid code in case of error in ComputeCode (thanks for confirming that -1 is indeed invalid as per the RFCs), get rid of the fmt dependency and remove unused second return value in the internal checkXxx functions.

Let me know if you want me to tweak a few things (or if you're not interested in the PR).

Thanks! Martin

dgryski commented 10 years ago

LGTM. Thanks!