Vendor SharedCode locally
Docker / Docker Build & Push (push) Failing after 1m19s
Lint / Lint (push) Successful in 15s
Tests / Go backend (push) Successful in 19s
Tests / Dashboard checks (push) Successful in 18s

This commit is contained in:
Gabriel20xx committed 2026-08-06 15:52:56 +02:00
1 parent a8c51b8484
commit 6eb8f4ad60
88 files changed
+9708 -275

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package auth
import (
"testing"
"time"
)
func TestVerifyTOTPRFC6238SHA1Vectors(t *testing.T) {
secret := "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
cases := []struct {
unix int64
code string
}{
{unix: 59, code: "287082"},
{unix: 1111111109, code: "081804"},
{unix: 1111111111, code: "050471"},
{unix: 1234567890, code: "005924"},
{unix: 2000000000, code: "279037"},
}
for _, testCase := range cases {
if !VerifyTOTP(secret, testCase.code, time.Unix(testCase.unix, 0)) {
t.Errorf("VerifyTOTP(%d, %q) = false", testCase.unix, testCase.code)
}
}
}
func TestTOTPProvisioningURI(t *testing.T) {
uri := TOTPProvisioningURI("Example App", "admin@example.com", "abc123")
if uri == "" || len(uri) < len("otpauth://totp/") || uri[:15] != "otpauth://totp/" {
t.Fatalf("unexpected provisioning URI: %q", uri)
}
}