We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b5eed24 + b755297 commit 765978bCopy full SHA for 765978b
pages/mfa.md
@@ -63,7 +63,7 @@ import (
63
"math"
64
)
65
66
-func generateTOTP(secret []byte) {
+func generateTOTP(secret []byte) string {
67
digits := 6
68
counter := time.Now().Unix() / 30
69
@@ -75,7 +75,7 @@ func generateTOTP(secret []byte) {
75
HS := mac.Sum(nil)
76
offset := HS[19] & 0x0f
77
Snum := binary.BigEndian.Uint32(HS[offset:offset+4]) & 0x7fffffff
78
- D := Snum % int(math.Pow(10, float64(digits)))
+ D := Snum % uint32(math.Pow(10, float64(digits)))
79
// Pad "0" to make it 6 digits.
80
return fmt.Sprintf("%06d", D)
81
}
0 commit comments