clean up code
- travisci is long dead - golangci-lint the repo
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
sudo: false
|
||||
language: go
|
||||
arch:
|
||||
- amd64
|
||||
- ppc64le
|
||||
go:
|
||||
- 1.14.x
|
||||
- 1.15.x
|
||||
- master
|
||||
@@ -1,7 +1,7 @@
|
||||
## `twofactor`
|
||||
|
||||
[](https://godoc.org/github.com/gokyle/twofactor)
|
||||
[](https://travis-ci.org/gokyle/twofactor)
|
||||
|
||||
|
||||
### Author
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
2
oath.go
2
oath.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
10
otp_test.go
10
otp_test.go
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user