From 0639f1e4fa26535427014aef60257bade3fd83ad Mon Sep 17 00:00:00 2001
From: yyamashita <yyamashita@hetzner.yyamashita.com>
Date: Sat, 20 Jun 2026 00:08:33 +0900
Subject: Fix passkey registration on iOS: strip hints field and set
 displayName

hints is a WebAuthn L3 field that older iOS Safari cannot process,
causing "String does not match expected pattern" TypeError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 app/routes/auth.register.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'app/routes/auth.register.tsx')

diff --git a/app/routes/auth.register.tsx b/app/routes/auth.register.tsx
index 01b0699..2b5ad2a 100644
--- a/app/routes/auth.register.tsx
+++ b/app/routes/auth.register.tsx
@@ -34,14 +34,17 @@ export async function action({ request }: Route.ActionArgs) {
       rpID,
       userID: new Uint8Array([109, 105, 99, 114, 111, 98, 108, 111, 103]), // "microblog"
       userName: "admin",
+      userDisplayName: "admin",
       attestationType: "none",
       authenticatorSelection: {
         residentKey: "required",
         userVerification: "required",
       },
     });
+    // hints は WebAuthn L3 の新フィールドで古い iOS が処理できないため除外
+    const { hints: _hints, ...safeOptions } = options as typeof options & { hints?: unknown };
     session.set("challenge", options.challenge);
-    return Response.json(options, {
+    return Response.json(safeOptions, {
       headers: { "Set-Cookie": await commitSession(session) },
     });
   }
-- 
cgit v1.2.3

