diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-20 00:22:20 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-20 00:22:20 +0900 |
| commit | 9da6a06bea17c26315225f394d997ff5379c8ad2 (patch) | |
| tree | 47bb6e9f462675f2e6e16db475f81a665c275b53 /app/routes/auth.register.tsx | |
| parent | 0b44daefb11b5eb764bca32ab2af79c5325a3672 (diff) | |
Debug passkey: send minimal options to isolate iOS SyntaxError
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/routes/auth.register.tsx')
| -rw-r--r-- | app/routes/auth.register.tsx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/routes/auth.register.tsx b/app/routes/auth.register.tsx index 64f4c78..06f42f5 100644 --- a/app/routes/auth.register.tsx +++ b/app/routes/auth.register.tsx @@ -41,14 +41,19 @@ export async function action({ request }: Route.ActionArgs) { userVerification: "required", }, }); - // hints (L3) と extensions (L2) は古い iOS Safari が処理できないため除外 - // また alg: -8 (Ed25519) も互換性のため除外 - const { hints: _h, extensions: _e, ...safeOptions } = options as typeof options & { hints?: unknown; extensions?: unknown }; - safeOptions.pubKeyCredParams = safeOptions.pubKeyCredParams.filter( - (p) => p.alg === -7 || p.alg === -257 - ); + // iOS Safari の parseCreationOptionsFromJSON は unknown フィールドで SyntaxError を投げるため + // 必須フィールドのみ送信して原因を絞り込む + const minimalOptions = { + rp: options.rp, + user: options.user, + challenge: options.challenge, + pubKeyCredParams: options.pubKeyCredParams.filter( + (p) => p.alg === -7 || p.alg === -257 + ), + }; + console.log("[passkey] options sent to browser:", JSON.stringify(minimalOptions)); session.set("challenge", options.challenge); - return Response.json(safeOptions, { + return Response.json(minimalOptions, { headers: { "Set-Cookie": await commitSession(session) }, }); } |
