Skip to content

Commit

Permalink
Fix small syntax typo in MFA example
Browse files Browse the repository at this point in the history
  • Loading branch information
agonzalezro authored Nov 6, 2024
1 parent b5eed24 commit b755297
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pages/mfa.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import (
"math"
)

func generateTOTP(secret []byte) {
func generateTOTP(secret []byte) string {
digits := 6
counter := time.Now().Unix() / 30

Expand All @@ -75,7 +75,7 @@ func generateTOTP(secret []byte) {
HS := mac.Sum(nil)
offset := HS[19] & 0x0f
Snum := binary.BigEndian.Uint32(HS[offset:offset+4]) & 0x7fffffff
D := Snum % int(math.Pow(10, float64(digits)))
D := Snum % uint32(math.Pow(10, float64(digits)))
// Pad "0" to make it 6 digits.
return fmt.Sprintf("%06d", D)
}
Expand Down

0 comments on commit b755297

Please sign in to comment.