linter fixes.
This commit is contained in:
@@ -52,10 +52,11 @@ func TestHotpBadRFC(t *testing.T) {
|
||||
otp := NewHOTP(testKey, 0, 6)
|
||||
for i := 0; i < len(rfcHotpExpected); i++ {
|
||||
code := otp.OTP()
|
||||
if code == "" {
|
||||
switch code {
|
||||
case "":
|
||||
fmt.Printf("twofactor: failed to produce an OTP\n")
|
||||
t.FailNow()
|
||||
} else if code == rfcHotpExpected[i] {
|
||||
case rfcHotpExpected[i]:
|
||||
fmt.Printf("twofactor: should not have received a valid OTP\n")
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
6
oath.go
6
oath.go
@@ -71,10 +71,10 @@ func (o OATH) URL(t Type, label string) string {
|
||||
v.Add("digits", fmt.Sprintf("%d", o.Size()))
|
||||
}
|
||||
|
||||
switch {
|
||||
case o.algo == crypto.SHA256:
|
||||
switch o.algo {
|
||||
case crypto.SHA256:
|
||||
v.Add("algorithm", "SHA256")
|
||||
case o.algo == crypto.SHA512:
|
||||
case crypto.SHA512:
|
||||
v.Add("algorithm", "SHA512")
|
||||
}
|
||||
|
||||
|
||||
6
otp.go
6
otp.go
@@ -75,10 +75,10 @@ func FromURL(URL string) (OTP, string, error) {
|
||||
return nil, "", ErrInvalidURL
|
||||
}
|
||||
|
||||
switch {
|
||||
case u.Host == "totp":
|
||||
switch u.Host {
|
||||
case "totp":
|
||||
return totpFromURL(u)
|
||||
case u.Host == "hotp":
|
||||
case "hotp":
|
||||
return hotpFromURL(u)
|
||||
default:
|
||||
return nil, "", ErrInvalidURL
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestPadding(t *testing.T) {
|
||||
for i := 0; i < 300; i++ {
|
||||
b := randString()
|
||||
origEncoding := string(b)
|
||||
modEncoding := strings.Replace(string(b), "=", "", -1)
|
||||
modEncoding := strings.ReplaceAll(string(b), "=", "")
|
||||
str, err := base32.StdEncoding.DecodeString(origEncoding)
|
||||
if err != nil {
|
||||
fmt.Println("Can't decode: ", string(b))
|
||||
|
||||
Reference in New Issue
Block a user