summaryrefslogtreecommitdiff
path: root/internal/controlplane/passkeys_test.go
diff options
context:
space:
mode:
authorChia <Chia@93.nz>2026-08-05 14:48:00 +1200
committerChia <Chia@93.nz>2026-08-05 14:48:00 +1200
commitcd0dd91ab93653631904f2ea0e574ccde6d60339 (patch)
treec65417b880a3f4a35c504c44edae821bc2122f70 /internal/controlplane/passkeys_test.go
parent86b1f42e3c5601ff10621a9779cf0076590797a1 (diff)
add passkey, totp.
Diffstat (limited to 'internal/controlplane/passkeys_test.go')
-rw-r--r--internal/controlplane/passkeys_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/controlplane/passkeys_test.go b/internal/controlplane/passkeys_test.go
new file mode 100644
index 0000000..8162133
--- /dev/null
+++ b/internal/controlplane/passkeys_test.go
@@ -0,0 +1,27 @@
+package controlplane
+
+import (
+ "testing"
+ "time"
+
+ "github.com/go-webauthn/webauthn/webauthn"
+)
+
+func TestEnsureWebAuthnExpirySetsServerSideDeadline(t *testing.T) {
+ before := time.Now().UTC()
+ session := &webauthn.SessionData{}
+ ensureWebAuthnExpiry(session)
+ if session.Expires.Before(before.Add(webAuthnChallengeTTL-time.Second)) ||
+ session.Expires.After(time.Now().UTC().Add(webAuthnChallengeTTL+time.Second)) {
+ t.Fatalf("expiry %s is not approximately %s from now", session.Expires, webAuthnChallengeTTL)
+ }
+}
+
+func TestEnsureWebAuthnExpiryPreservesLibraryDeadline(t *testing.T) {
+ want := time.Now().UTC().Add(time.Minute)
+ session := &webauthn.SessionData{Expires: want}
+ ensureWebAuthnExpiry(session)
+ if !session.Expires.Equal(want) {
+ t.Fatalf("expiry = %s, want %s", session.Expires, want)
+ }
+}