clean up code

- travisci is long dead
- golangci-lint the repo
This commit is contained in:
2024-12-02 13:47:43 -08:00
parent 024d552293
commit 0dcd18c6f1
6 changed files with 9 additions and 20 deletions

View File

@@ -1,9 +0,0 @@
sudo: false
language: go
arch:
- amd64
- ppc64le
go:
- 1.14.x
- 1.15.x
- master

View File

@@ -1,7 +1,7 @@
## `twofactor`
[![GoDoc](https://godoc.org/github.com/gokyle/twofactor?status.svg)](https://godoc.org/github.com/gokyle/twofactor)
[![Build Status](https://travis-ci.org/gokyle/twofactor.svg?branch=master)](https://travis-ci.org/gokyle/twofactor)
### Author

View File

@@ -7,10 +7,6 @@ import (
var testKey = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
func newZeroHOTP() *HOTP {
return NewHOTP(testKey, 0, 6)
}
var rfcHotpKey = []byte("12345678901234567890")
var rfcHotpExpected = []string{
"755224",

View File

@@ -35,7 +35,7 @@ func (o OATH) Counter() uint64 {
}
// SetCounter updates the OATH token's counter to a new value.
func (o OATH) SetCounter(counter uint64) {
func (o *OATH) SetCounter(counter uint64) {
o.counter = counter
}

View File

@@ -1,8 +1,10 @@
package twofactor
import "fmt"
import "io"
import "testing"
import (
"fmt"
"io"
"testing"
)
func TestHOTPString(t *testing.T) {
hotp := NewHOTP(nil, 0, 6)
@@ -93,7 +95,7 @@ func TestPaddedURL(t *testing.T) {
for i := range urlList {
if o, id, err := FromURL(urlList[i]); err != nil {
fmt.Println("hotp: URL should have parsed successfully")
fmt.Println("hotp: URL should have parsed successfully (id=", id, ")")
fmt.Printf("\turl was: %s\n", urlList[i])
t.FailNow()
fmt.Printf("\t%s, %s\n", o.OTP(), id)

View File

@@ -44,7 +44,7 @@ var rfcTotpTests = []struct {
func TestTotpRFC(t *testing.T) {
for _, tc := range rfcTotpTests {
otp := NewTOTP(rfcTotpKey[tc.Algo], 0, 30, 8, tc.Algo)
otp := NewTOTP(rfcTotpKey[tc.Algo], 0, rfcTotpStep, 8, tc.Algo)
if otp.otpCounter(tc.Time) != tc.T {
fmt.Printf("twofactor: invalid TOTP (t=%d, h=%d)\n", tc.Time, tc.Algo)
fmt.Printf("\texpected: %d\n", tc.T)