diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-20 00:13:24 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-20 00:13:24 +0900 |
| commit | 0b44daefb11b5eb764bca32ab2af79c5325a3672 (patch) | |
| tree | 27761e4c9ec780697f4f3944cc028c281b2395b5 /app/routes/auth.register.tsx | |
| parent | 0639f1e4fa26535427014aef60257bade3fd83ad (diff) | |
Strip extensions + filter algs for iOS Safari compatibility
- Remove extensions.credProps (WebAuthn L2, causes TypeError on older iOS)
- Remove alg:-8 (Ed25519, not universally supported)
- Show error name in UI for easier debugging
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 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/routes/auth.register.tsx b/app/routes/auth.register.tsx index 2b5ad2a..64f4c78 100644 --- a/app/routes/auth.register.tsx +++ b/app/routes/auth.register.tsx @@ -41,8 +41,12 @@ export async function action({ request }: Route.ActionArgs) { userVerification: "required", }, }); - // hints は WebAuthn L3 の新フィールドで古い iOS が処理できないため除外 - const { hints: _hints, ...safeOptions } = options as typeof options & { hints?: unknown }; + // 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 + ); session.set("challenge", options.challenge); return Response.json(safeOptions, { headers: { "Set-Cookie": await commitSession(session) }, @@ -127,7 +131,7 @@ export default function Register() { window.location.href = "/"; } catch (e) { setStatus("error"); - setErrorMsg(e instanceof Error ? e.message : "エラーが発生しました"); + setErrorMsg(e instanceof Error ? `${e.name}: ${e.message}` : String(e)); } } |
