feat: import Sea vHost single-server testing release
This commit is contained in:
commit
248badd33e
441 files changed
+63221
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestTOTPVerificationWindow(t *testing.T) {
|
||||
secret := "JBSWY3DPEHPK3PXP"
|
||||
now := time.Unix(1_700_000_000, 0)
|
||||
code := totpAt(secret, now.Unix()/totpPeriod)
|
||||
if !VerifyTOTP(secret, code, now) {
|
||||
t.Fatal("current TOTP code was rejected")
|
||||
}
|
||||
if VerifyTOTP(secret, "0000000", now) || VerifyTOTP(secret, "abcdef", now) {
|
||||
t.Fatal("malformed TOTP code was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRecoveryCodeHashNormalizesFormatting(t *testing.T) {
|
||||
if !bytes.Equal(RecoveryCodeHash("abcd-efgh-ijkl"), RecoveryCodeHash(" ABCDEFGHIJKL ")) {
|
||||
t.Fatal("equivalent recovery codes produced different hashes")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user