- 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
26 lines
621 B
Go
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")
|
|
}
|
|
}
|