Skip to content

Commit

Permalink
feat: otp recovery code defaults (#138)
Browse files Browse the repository at this point in the history
* feat: align defaults with config default

Signed-off-by: Sarah Funkhouser <[email protected]>

* remove log

Signed-off-by: Sarah Funkhouser <[email protected]>

---------

Signed-off-by: Sarah Funkhouser <[email protected]>
  • Loading branch information
golanglemonade authored Jan 27, 2025
1 parent c17eada commit 4ded220
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion totp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package totp
const (
defaultLength = 6
defaultRecoveryCodeCount = 16
defaultRecoveryCodeLength = 10
defaultRecoveryCodeLength = 8
codePeriod = 30
)

Expand Down
3 changes: 1 addition & 2 deletions totp/totp.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ func GenerateOTP(secret string) (string, error) {
func (o *OTP) GenerateRecoveryCodes() []string {
codes := []string{}

// for range o.recoveryCodeCount { // this works in go 1.22 but the linter barfs while its still on 1.21
for i := 1; i <= o.recoveryCodeCount; i++ {
for range o.recoveryCodeCount {
code, err := String(o.recoveryCodeLength, alphanumericCode)
if err != nil {
continue
Expand Down

0 comments on commit 4ded220

Please sign in to comment.