NextMyDay/internal/core/auth/webauthn/webauthn_test.go
Claus Lohmar 76a4a6950c feat(auth): add WebAuthn, TOTP and the enroll/login flow (SPEC-004/006)
- webauthn: the passkey ceremony service (a fake in tests)
- totp: the TOTP authenticator; the secret is AEAD-sealed at rest (A9)
- sealer: the AEAD TOTP sealer
- identities/sessions/credentials: the GUID state machine
- flow: the enroll/login screens + the passkey nudge (pre-session
  double-submit CSRF — A15), rendered inside the shell
2026-10-14 10:53:53 +00:00

26 lines
621 B
Go

package webauthn_test
import (
"testing"
"git.lohmar.co.uk/cclohmar/NextMyDay/internal/core/auth/webauthn"
)
func TestNewValidatesConfig(t *testing.T) {
svc, err := webauthn.New(webauthn.Config{
RPID: "myday.example.com",
RPDisplayName: "MyDay",
RPOrigins: []string{"https://myday.example.com"},
})
if err != nil {
t.Fatalf("New(valid) = %v, want nil", err)
}
if svc == nil {
t.Fatal("New returned a nil service")
}
// No origin -> fail closed.
if _, err := webauthn.New(webauthn.Config{RPID: "myday.example.com"}); err == nil {
t.Error("New(no origins) = nil, want an error")
}
}