File: hotp_test.go

package info (click to toggle)
golang-github-xlzd-gotp 0.0~git20181030.c8557ba-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 108 kB
  • sloc: makefile: 5
file content (20 lines) | stat: -rw-r--r-- 309 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package gotp

import (
	"testing"
)

var hotp = NewDefaultHOTP("4S62BZNFXXSZLCRO")

func TestHOTP_At(t *testing.T) {
	otp := hotp.At(12345)
	if "194001" != otp {
		t.Error("HOTP generate otp error")
	}
}

func TestHOTP_Verify(t *testing.T) {
	if !hotp.Verify("194001", 12345) {
		t.Error("verify faild")
	}
}