Consolidate and simplify the generation of codes.

Rework gauth.Code as gauth.Codes, which returns the previous, current, and next
strings in one step. Remove authCodeOrDie, since there is now only one decode
step to check.

The implementation now uses the bitbucket.org/creachadair/otp package, which
makes the code simpler and subsumes normalizeSecret.
This commit is contained in:
M. J. Fromberger
2019-06-02 09:00:37 -07:00
parent c217b384f0
commit 9d95eb95fd
5 changed files with 24 additions and 62 deletions

1
go.mod
View File

@ -3,6 +3,7 @@ module github.com/pcarrier/gauth
go 1.12
require (
bitbucket.org/creachadair/otp v0.0.2
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2 // indirect
)