[{"data":1,"prerenderedAt":5323},["ShallowReactive",2],{"\u002Fblog\u002Fwebauthn-rails-setup-passkey-registration":3},{"path":4,"data":5,"meta":18,"nodes":106},"\u002Fblog\u002Fwebauthn-rails-setup-passkey-registration",{"title":6,"description":7,"date":8,"tags":9,"authors":11,"image":14,"seo":15},"Implementing WebAuthn (Passkeys) in Rails: Setup and Registration","Learn how to implement passkey registration in Ruby on Rails using Devise and the WebAuthn gem.","2026-02-18",[10],"engineering",[12,13],"Ali Fadel","Ibraheem Tuffaha","\u002Fimages\u002Fblog\u002Frails-passwordless-authentication-webauthn-2fa.webp",{"title":16,"description":17},"Implementing WebAuthn (Passkeys) in Rails: Setup Guide","Learn how to implement passkey registration in Ruby on Rails using Devise and the WebAuthn gem. Step-by-step tutorial for modern authentication.",{"toc":19,"key":98,"source":99,"stem":100,"extension":101,"kind":102,"type":103,"partial":104,"hash":105},{"title":20,"searchDepth":21,"depth":21,"links":22},"",2,[23,26,40,43,65,92,95],{"id":24,"depth":21,"text":25},"who-this-is-for","Who This Is For",{"id":27,"depth":21,"text":28,"children":29},"how-webauthn-works","How WebAuthn Works",[30,34,37],{"id":31,"depth":32,"text":33},"how-webauthn-works-registration-creating-a-passkey",3,"Registration: Creating a Passkey",{"id":35,"depth":32,"text":36},"how-webauthn-works-authentication-signing-in-with-a-passkey","Authentication: Signing In with a Passkey",{"id":38,"depth":32,"text":39},"how-webauthn-works-the-mental-model","The Mental Model",{"id":41,"depth":21,"text":42},"the-stack","The Stack",{"id":44,"depth":21,"text":45,"children":46},"setting-up-the-foundation","Setting Up the Foundation",[47,50,53,56,59,62],{"id":48,"depth":32,"text":49},"setting-up-the-foundation-the-backend-webauthn-gem","The Backend: webauthn gem",{"id":51,"depth":32,"text":52},"setting-up-the-foundation-the-frontend-simplewebauthnbrowser","The Frontend: @simplewebauthn\u002Fbrowser",{"id":54,"depth":32,"text":55},"setting-up-the-foundation-what-can-go-wrong","What Can Go Wrong",{"id":57,"depth":32,"text":58},"setting-up-the-foundation-the-database-schema","The Database Schema",{"id":60,"depth":32,"text":61},"setting-up-the-foundation-the-webauthncredential-model","The WebAuthnCredential Model",{"id":63,"depth":32,"text":64},"setting-up-the-foundation-the-user-model-changes","The User Model Changes",{"id":66,"depth":21,"text":67,"children":68},"passkey-registration-adding-passkeys-to-existing-accounts","Passkey Registration (Adding Passkeys to Existing Accounts)",[69,72,75,78,81,84,87,90],{"id":70,"depth":32,"text":71},"passkey-registration-adding-passkeys-to-existing-accounts-the-routes-backend","The Routes [Backend]",{"id":73,"depth":32,"text":74},"passkey-registration-adding-passkeys-to-existing-accounts-the-options-controller-backend","The Options Controller [Backend]",{"id":76,"depth":32,"text":77},"passkey-registration-adding-passkeys-to-existing-accounts-the-credentials-controller-backend","The Credentials Controller [Backend]",{"id":79,"depth":32,"text":80},"passkey-registration-adding-passkeys-to-existing-accounts-the-security-page-backend","The Security Page [Backend]",{"id":82,"depth":32,"text":83},"passkey-registration-adding-passkeys-to-existing-accounts-handling-parameter-transformation-backend","Handling Parameter Transformation [Backend]",{"id":85,"depth":32,"text":86},"passkey-registration-adding-passkeys-to-existing-accounts-the-registration-modal-frontend","The Registration Modal [Frontend]",{"id":88,"depth":32,"text":89},"passkey-registration-adding-passkeys-to-existing-accounts-the-parent-component-frontend","The Parent Component [Frontend]",{"id":91,"depth":32,"text":55},"passkey-registration-adding-passkeys-to-existing-accounts-what-can-go-wrong",{"id":93,"depth":21,"text":94},"routes-added-in-this-part","Routes Added in This Part",{"id":96,"depth":21,"text":97},"whats-next","What's Next","blog\u002Fwebauthn-rails-setup-passkey-registration.md","blog","webauthn-rails-setup-passkey-registration",".md","document","text\u002Fmarkdown",false,"a71fcd77cddc1ea6",[107,114,182,185,213,219,222,225,241,248,261,267,273,275,278,286,289,292,295,301,304,306,309,314,320,332,334,337,413,420,422,425,462,464,466,473,501,504,645,648,662,675,680,685,688,725,733,735,753,763,784,786,789,828,830,833,1066,1069,1095,1102,1176,1179,1181,1350,1363,1365,1368,1449,1455,1457,1460,1465,1468,1492,1494,1497,1566,1569,1589,1591,1594,1854,1857,1863,1898,1908,1931,1937,1954,1957,1980,1982,1985,1995,2417,2420,2430,2500,2511,2517,2563,2573,2579,2585,2591,2593,2606,2609,2652,2655,2760,2763,2766,2768,2771,2865,2881,2884,2923,2925,2928,2945,2948,3190,3201,3219,3222,3368,3371,3374,3673,3686,3689,3856,3869,3872,3983,4000,4003,4660,4673,4675,4681,5118,5133,5136,5153,5155,5158,5187,5189,5279,5282,5302,5304,5307,5313],[108,109,110],"p",{},[111,112,113],"em",{},"This is Part 1 of a 4-part series on implementing WebAuthn in Rails with Devise and Inertia.js.",[115,116,117,130],"table",{},[118,119,120],"thead",{},[121,122,123,127],"tr",{},[124,125,126],"th",{},"Part",[124,128,129],{},"Title",[131,132,133,148,160,171],"tbody",{},[121,134,135,142],{},[136,137,138],"td",{},[139,140,141],"strong",{},"1",[136,143,144,147],{},[139,145,146],{},"Setup and Registration"," (you are here)",[121,149,150,153],{},[136,151,152],{},"2",[136,154,155],{},[156,157,159],"a",{"href":158},"https:\u002F\u002Fwww.milkstraw.ai\u002Fblog\u002Frails-passwordless-authentication-webauthn-2fa","Authentication: From 2FA to Password-less",[121,161,162,165],{},[136,163,164],{},"3",[136,166,167],{},[156,168,170],{"href":169},"https:\u002F\u002Fwww.milkstraw.ai\u002Fblog\u002Fwebauthn-backup-codes-account-recovery-rails","Backup Codes: The Safety Net",[121,172,173,176],{},[136,174,175],{},"4",[136,177,178],{},[156,179,181],{"href":180},"https:\u002F\u002Fwww.milkstraw.ai\u002Fblog\u002Fwebauthn-implementation-design-tradeoffs-rails","Design Decisions and Trade-offs",[108,183,184],{},"Passwords are terrible. You know it. I know it. Your users know it. They forget them, reuse them across sites, and fall for phishing attacks. Passkeys fix this by replacing passwords with cryptographic key pairs tied to biometrics or hardware keys.",[108,186,187,188,192,193,197,198,202,203,207,208,212],{},"This post walks through how we implemented WebAuthn in ",[156,189,191],{"href":190},"https:\u002F\u002Frubyonrails.org\u002F","Rails"," at ",[156,194,196],{"href":195},"https:\u002F\u002Fmilkstraw.ai\u002F","MilkStraw AI",". By using ",[156,199,201],{"href":200},"https:\u002F\u002Fgithub.com\u002Fheartcombo\u002Fdevise","Devise"," for authentication alongside ",[156,204,206],{"href":205},"https:\u002F\u002Finertia-rails.dev\u002F","Inertia.js"," and ",[156,209,211],{"href":210},"https:\u002F\u002Fvuejs.org\u002F","Vue 3",", we've built a modern, secure sign-in experience. We started with a password-full flow (passkeys as 2FA), then added password-less authentication, then backup codes. We did it this way intentionally. Building incrementally allowed us to test and include both solutions in this tutorial. While both are valid, we ultimately decided to use password-less for its simpler UX and cleaner code.",[108,214,215,218],{},[139,216,217],{},"One thing to note upfront",": the frontend implementation here is specific to our app's UX. Your sign-in flow might look completely different. The backend patterns are more generalizable, but you'll need to adapt the Vue components to fit your design.",[220,221,25],"h2",{"id":24},[108,223,224],{},"This series is for developers who:",[226,227,228,232,235,238],"ul",{},[229,230,231],"li",{},"Already have a Rails app with Devise authentication working",[229,233,234],{},"Want to add passkey support (either as 2FA or password-less)",[229,236,237],{},"Are comfortable reading Ruby and TypeScript\u002FVue code",[229,239,240],{},"Want to understand what they're building, not just copy-paste",[108,242,243,244,247],{},"This is ",[139,245,246],{},"not"," a beginner tutorial. We assume you know how Devise works, can read controller code, and understand basic authentication concepts.",[108,249,250,251,255,256,260],{},"If you're looking for a hosted solution or want passkeys without touching code, services like ",[156,252,254],{"href":253},"https:\u002F\u002Fauth0.com\u002F","Auth0"," or ",[156,257,259],{"href":258},"https:\u002F\u002Fclerk.com\u002F","Clerk"," might be a better fit. We chose to build this ourselves because authentication is core to our product and we wanted full control.",[108,262,263,266],{},[139,264,265],{},"In this post",", we'll cover the foundation (gem configuration, database schema, models) and passkey registration. By the end, your users will be able to add passkeys to their accounts.",[108,268,269,272],{},[139,270,271],{},"How this series is organized",": Each part builds on the previous one and delivers working code. Part 1 gives you passkey registration. Part 2 adds authentication (first as 2FA, then password-less). Part 3 adds backup codes for recovery. Part 4 discusses design decisions. If you're following along and implementing as you go, note that some code from earlier parts gets refactored in later parts - we'll flag these when they come up.",[220,274,28],{"id":27},[108,276,277],{},"Before diving into implementation, let's understand what WebAuthn actually does. It's a three-party protocol between your server (the Relying Party), the user's browser, and an authenticator (Touch ID, Face ID, YubiKey, etc.).",[108,279,280,281,285],{},"The protocol has two flows: registration (creating a passkey) and authentication (using a passkey to sign in). Both follow a challenge-response pattern to prevent ",[156,282,284],{"href":283},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FReplay_attack","replay attacks",".",[108,287,288],{},"The server sends specific options (such as the user's ID, allowed algorithms, and security preferences) that tell the browser how to interact with the authenticator, which we will detail once implementing the corresponding controllers.",[290,291,33],"h3",{"id":31},[108,293,294],{},"When a user wants to add a passkey, your server generates a random challenge. The authenticator creates a new key pair, signs the challenge and origin with the private key, and sends back the public key and signed data. Your server verifies the signature and challenge, then stores the public key",[108,296,297],{},[298,299],"img",{"src":300},"\u002Fimages\u002Fblog\u002Fwebauthn-rails-setup-passkey-registration-1.webp",[108,302,303],{},"The private key never leaves the authenticator. It's stored in secure hardware (the Secure Enclave on Apple devices, TPM on Windows, etc.) and can't be extracted.",[290,305,36],{"id":35},[108,307,308],{},"When a user signs in, your server generates a new challenge. The authenticator signs this challenge and origin with the private key it created during registration. Your server verifies the signature using the stored public key and checks that the challenge matches.",[108,310,311],{},[298,312],{"src":313},"\u002Fimages\u002Fblog\u002Fwebauthn-rails-setup-passkey-registration-2.webp",[108,315,316,319],{},[139,317,318],{},"The key insight",": your server only stores public keys. Even if your database is compromised, attackers can't impersonate users because they don't have the private keys. And because each authentication requires a fresh challenge, captured responses can't be replayed.",[108,321,322,323,327,328,285],{},"For a deeper dive into WebAuthn, check out the ",[156,324,326],{"href":325},"https:\u002F\u002Fwebauthn.guide\u002F","WebAuthn Guide"," or the ",[156,329,331],{"href":330},"https:\u002F\u002Fwww.w3.org\u002FTR\u002Fwebauthn-2","W3C Web Authentication spec",[290,333,39],{"id":38},[108,335,336],{},"Here's how to think about WebAuthn in Rails terms:",[115,338,339,352],{},[118,340,341],{},[121,342,343,346,349],{},[124,344,345],{},"WebAuthn Concept",[124,347,348],{},"Rails Equivalent",[124,350,351],{},"What It Does",[131,353,354,365,376,391,402],{},[121,355,356,359,362],{},[136,357,358],{},"Relying Party (RP)",[136,360,361],{},"Your Rails app",[136,363,364],{},"Issues challenges, verifies responses",[121,366,367,370,373],{},[136,368,369],{},"Authenticator",[136,371,372],{},"Touch ID, YubiKey, etc.",[136,374,375],{},"Holds private keys, signs challenges",[121,377,378,381,388],{},[136,379,380],{},"Credential",[136,382,383,387],{},[384,385,386],"code",{},"WebAuthnCredential"," model",[136,389,390],{},"Stores public key for verification",[121,392,393,396,399],{},[136,394,395],{},"Challenge",[136,397,398],{},"Session value",[136,400,401],{},"Random nonce to prevent replay attacks",[121,403,404,407,410],{},[136,405,406],{},"Ceremony",[136,408,409],{},"Controller action",[136,411,412],{},"The registration or authentication flow",[108,414,415,416,419],{},"The key mental shift: ",[139,417,418],{},"your server never sees passwords or private keys",". You're verifying cryptographic signatures, not comparing secrets. The authenticator proves it holds the private key by signing a challenge. You verify the signature with the stored public key.",[220,421,42],{"id":41},[108,423,424],{},"Before diving in, here's what we're working with:",[226,426,427,433,448],{},[229,428,429,432],{},[139,430,431],{},"Backend",": Ruby on Rails 8.0, Devise for authentication",[229,434,435,438,439,443,444],{},[139,436,437],{},"Frontend",": Inertia.js with Vue 3, TypeScript, ",[156,440,442],{"href":441},"https:\u002F\u002Ftailwindcss.com\u002F","TailwindCSS",", ",[156,445,447],{"href":446},"https:\u002F\u002Fui.nuxt.com\u002F","Nuxt UI",[229,449,450,453,454,457,458,461],{},[139,451,452],{},"WebAuthn Libraries",": ",[384,455,456],{},"webauthn"," gem (backend), ",[384,459,460],{},"@simplewebauthn\u002Fbrowser"," (frontend)",[220,463,45],{"id":44},[290,465,49],{"id":48},[108,467,468,469,472],{},"First, add the gem to your ",[384,470,471],{},"Gemfile",":",[474,475,478],"pre",{"language":476,"class":477},"ruby","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[384,479,481,490,491],{"class":480},"language-ruby",[482,483,486],"span",{"class":484,"style":485},"line","display: inline",[482,487,489],{"style":488},"color:#6E7781;--shiki-dark:#8B949E","# Gemfile","\n",[482,492,493,497],{"class":484,"style":485},[482,494,496],{"style":495},"color:#1F2328;--shiki-dark:#E6EDF3","gem ",[482,498,500],{"style":499},"color:#0A3069;--shiki-dark:#A5D6FF","'webauthn'",[108,502,503],{},"Then create an initializer. The configuration here is critical:",[474,505,506],{"language":476,"class":477},[384,507,508,490,513,490,532,490,565,490,567,490,579,490,601,490,606,490,614,490,616,490,628,490,640],{"class":480},[482,509,510],{"class":484,"style":485},[482,511,512],{"style":488},"# config\u002Finitializers\u002Fwebauthn.rb",[482,514,515,519,521,525,529],{"class":484,"style":485},[482,516,518],{"style":517},"color:#0550AE;--shiki-dark:#79C0FF","WebAuthn",[482,520,285],{"style":495},[482,522,524],{"style":523},"color:#8250DF;--shiki-dark:#D2A8FF","configure",[482,526,528],{"style":527},"color:#CF222E;--shiki-dark:#FF7B72"," do",[482,530,531],{"style":495}," |config|",[482,533,534,537,540,543,546,548,551,554,557,559,562],{"class":484,"style":485},[482,535,536],{"style":495},"  config.",[482,538,539],{"style":523},"rp_id",[482,541,542],{"style":527}," =",[482,544,545],{"style":517}," ENV",[482,547,285],{"style":495},[482,549,550],{"style":523},"fetch",[482,552,553],{"style":495},"(",[482,555,556],{"style":499},"'WEBAUTHN_RP_ID'",[482,558,443],{"style":495},[482,560,561],{"style":499},"'localhost'",[482,563,564],{"style":495},")",[482,566],{"class":484,"style":485},[482,568,569,571,574,576],{"class":484,"style":485},[482,570,536],{"style":495},[482,572,573],{"style":523},"allowed_origins",[482,575,542],{"style":527},[482,577,578],{"style":495}," [",[482,580,581,584,586,588,590,593,595,598],{"class":484,"style":485},[482,582,583],{"style":517},"    ENV",[482,585,285],{"style":495},[482,587,550],{"style":523},[482,589,553],{"style":495},[482,591,592],{"style":499},"'APP_URL'",[482,594,443],{"style":495},[482,596,597],{"style":517},"nil",[482,599,600],{"style":495},"),",[482,602,603],{"class":484,"style":485},[482,604,605],{"style":499},"    'http:\u002F\u002Flocalhost:3000'",[482,607,608,611],{"class":484,"style":485},[482,609,610],{"style":495},"  ].",[482,612,613],{"style":523},"compact",[482,615],{"class":484,"style":485},[482,617,618,620,623,625],{"class":484,"style":485},[482,619,536],{"style":495},[482,621,622],{"style":523},"rp_name",[482,624,542],{"style":527},[482,626,627],{"style":499}," 'Your App Name'",[482,629,630,632,635,637],{"class":484,"style":485},[482,631,536],{"style":495},[482,633,634],{"style":523},"credential_options_timeout",[482,636,542],{"style":527},[482,638,639],{"style":517}," 120_000",[482,641,642],{"class":484,"style":485},[482,643,644],{"style":527},"end",[108,646,647],{},"Let's break down these settings.",[108,649,650,651,653,654,657,658,661],{},"The ",[384,652,539],{}," (Relying Party ID) is the trickiest part. It must match your domain without the protocol or port. For ",[384,655,656],{},"app.milkstraw.ai",", the RP ID is ",[384,659,660],{},"milkstraw.ai",". This matters because passkeys registered on the root domain work for all subdomains, but not vice versa.",[108,663,650,664,666,667,670,671,674],{},[384,665,573],{}," setting tells the WebAuthn gem which origins are permitted to make authentication requests. This is a security measure that prevents credentials from being used on malicious sites. Each origin must include the protocol (",[384,668,669],{},"https:\u002F\u002F",") and, for non-standard ports, the port number. In development, you'll typically include ",[384,672,673],{},"http:\u002F\u002Flocalhost:3000",". In production, include your actual domain. If a request comes from an origin not in this list, authentication will fail.",[108,676,650,677,679],{},[384,678,622],{}," is the human-readable name of your application shown in the browser’s native security prompts. It helps users identify which site is requesting their biometric or security key.",[108,681,650,682,684],{},[384,683,634],{}," sets the duration (in milliseconds) the challenge remains valid. We use 120_000 (2 minutes) to give users ample time to interact with their authenticator before the request expires.",[108,686,687],{},"We also define two constants for session keys. This keeps our session management consistent across controllers:",[474,689,690],{"language":476,"class":477},[384,691,692,490,696,490,711],{"class":480},[482,693,694],{"class":484,"style":485},[482,695,512],{"style":488},[482,697,698,700,703,706,708],{"class":484,"style":485},[482,699,518],{"style":517},[482,701,702],{"style":495},"::",[482,704,705],{"style":517},"SESSION_KEY",[482,707,542],{"style":527},[482,709,710],{"style":517}," :web_authn_authentication",[482,712,713,715,717,720,722],{"class":484,"style":485},[482,714,518],{"style":517},[482,716,702],{"style":495},[482,718,719],{"style":517},"REGISTRATION_CHALLENGE_KEY",[482,721,542],{"style":527},[482,723,724],{"style":517}," :web_authn_registration_challenge",[108,726,727,729,730,732],{},[384,728,705],{}," tracks pending authentications (storing the user's identity while they complete passkey verification). ",[384,731,719],{}," stores the challenge during passkey registration.",[290,734,52],{"id":51},[474,736,738],{"language":737,"class":477},"bash",[384,739,741],{"class":740},"language-bash",[482,742,743,747,750],{"class":484,"style":485},[482,744,746],{"style":745},"color:#953800;--shiki-dark:#FFA657","yarn",[482,748,749],{"style":499}," add",[482,751,752],{"style":499}," @simplewebauthn\u002Fbrowser",[108,754,755,756,207,759,762],{},"This package handles the browser's WebAuthn API. It provides ",[384,757,758],{},"startRegistration()",[384,760,761],{},"startAuthentication()"," functions that abstract away the complexity of the native APIs.",[108,764,765,768,769,772,773,776,777,779,780,783],{},[139,766,767],{},"Side note on route helpers",": We use the ",[384,770,771],{},"js-routes"," gem to generate type-safe route helpers for the frontend. This is a convenience, not a requirement. You could just as easily hardcode the URLs. But if you want to avoid ",[384,774,775],{},"\u002Fweb_authn\u002Fcredentials"," strings scattered throughout your code, ",[384,778,771],{}," generates functions like ",[384,781,782],{},"web_authn_credentials_path()"," that mirror Rails' route helpers. It's nice to have, but don't let it distract you from the core implementation.",[290,785,55],{"id":54},[108,787,788],{},"Common setup issues that will bite you:",[226,790,791,805,818],{},[229,792,793,796,798,799,801,802,804],{},[139,794,795],{},"Wrong",[384,797,539],{},": If your RP ID doesn't match your domain, passkeys won't work. For ",[384,800,656],{},", the RP ID must be ",[384,803,660],{}," (no protocol, no subdomain). Get this wrong and you'll see cryptic \"InvalidStateError\" messages in the browser console.",[229,806,807,810,811,813,814,817],{},[139,808,809],{},"Missing origin",": If your production URL isn't in ",[384,812,573],{},", authentication will fail silently. Always include both development (",[384,815,816],{},"localhost:3000",") and production URLs.",[229,819,820,823,824,827],{},[139,821,822],{},"HTTPS requirement",": WebAuthn only works over HTTPS in production. ",[384,825,826],{},"localhost"," gets a pass for development, but any other domain needs TLS.",[290,829,58],{"id":57},[108,831,832],{},"We need a model for storing WebAuthn credentials. A credential represents a single passkey that a user has registered. Each credential is tied to a specific authenticator (Touch ID on their MacBook, Face ID on their iPhone, a YubiKey, etc.). Users can have multiple credentials, which is important. If they only had one and lost the device, they'd be locked out. Multiple credentials let them register passkeys on different devices as backups for each other.",[474,834,835],{"language":476,"class":477},[384,836,837,490,842,490,865,490,873,490,894,490,928,490,944,490,959,490,974,490,998,490,1000,490,1007,490,1012,490,1014,490,1033,490,1057,490,1062],{"class":480},[482,838,839],{"class":484,"style":485},[482,840,841],{"style":488},"# db\u002Fmigrate\u002Fcreate_web_authn_credentials.rb",[482,843,844,847,850,853,856,859,862],{"class":484,"style":485},[482,845,846],{"style":527},"class",[482,848,849],{"style":745}," CreateWebAuthnCredentials",[482,851,852],{"style":495}," \u003C ",[482,854,855],{"style":517},"ActiveRecord::Migration",[482,857,858],{"style":495},"[",[482,860,861],{"style":517},"8.0",[482,863,864],{"style":495},"]",[482,866,867,870],{"class":484,"style":485},[482,868,869],{"style":527},"  def",[482,871,872],{"style":523}," change",[482,874,875,878,881,883,886,889,891],{"class":484,"style":485},[482,876,877],{"style":495},"    create_table ",[482,879,880],{"style":517},":web_authn_credentials",[482,882,443],{"style":495},[482,884,885],{"style":517},"id:",[482,887,888],{"style":517}," :uuid",[482,890,528],{"style":527},[482,892,893],{"style":495}," |t|",[482,895,896,899,902,905,907,910,913,915,918,921,923,926],{"class":484,"style":485},[482,897,898],{"style":495},"      t.",[482,900,901],{"style":523},"references",[482,903,904],{"style":517}," :user",[482,906,443],{"style":495},[482,908,909],{"style":517},"null:",[482,911,912],{"style":517}," false",[482,914,443],{"style":495},[482,916,917],{"style":517},"foreign_key:",[482,919,920],{"style":517}," true",[482,922,443],{"style":495},[482,924,925],{"style":517},"type:",[482,927,888],{"style":517},[482,929,930,932,935,938,940,942],{"class":484,"style":485},[482,931,898],{"style":495},[482,933,934],{"style":523},"string",[482,936,937],{"style":517}," :external_id",[482,939,443],{"style":495},[482,941,909],{"style":517},[482,943,912],{"style":517},[482,945,946,948,950,953,955,957],{"class":484,"style":485},[482,947,898],{"style":495},[482,949,934],{"style":523},[482,951,952],{"style":517}," :public_key",[482,954,443],{"style":495},[482,956,909],{"style":517},[482,958,912],{"style":517},[482,960,961,963,965,968,970,972],{"class":484,"style":485},[482,962,898],{"style":495},[482,964,934],{"style":523},[482,966,967],{"style":517}," :nickname",[482,969,443],{"style":495},[482,971,909],{"style":517},[482,973,912],{"style":517},[482,975,976,978,981,984,986,988,990,992,995],{"class":484,"style":485},[482,977,898],{"style":495},[482,979,980],{"style":523},"integer",[482,982,983],{"style":517}," :sign_count",[482,985,443],{"style":495},[482,987,909],{"style":517},[482,989,912],{"style":517},[482,991,443],{"style":495},[482,993,994],{"style":517},"default:",[482,996,997],{"style":517}," 0",[482,999],{"class":484,"style":485},[482,1001,1002,1004],{"class":484,"style":485},[482,1003,898],{"style":495},[482,1005,1006],{"style":523},"timestamps",[482,1008,1009],{"class":484,"style":485},[482,1010,1011],{"style":527},"    end",[482,1013],{"class":484,"style":485},[482,1015,1016,1019,1021,1023,1026,1028,1031],{"class":484,"style":485},[482,1017,1018],{"style":495},"    add_index ",[482,1020,880],{"style":517},[482,1022,443],{"style":495},[482,1024,1025],{"style":517},":external_id",[482,1027,443],{"style":495},[482,1029,1030],{"style":517},"unique:",[482,1032,920],{"style":517},[482,1034,1035,1037,1039,1042,1045,1047,1050,1053,1055],{"class":484,"style":485},[482,1036,1018],{"style":495},[482,1038,880],{"style":517},[482,1040,1041],{"style":495},", [",[482,1043,1044],{"style":517},":nickname",[482,1046,443],{"style":495},[482,1048,1049],{"style":517},":user_id",[482,1051,1052],{"style":495},"], ",[482,1054,1030],{"style":517},[482,1056,920],{"style":517},[482,1058,1059],{"class":484,"style":485},[482,1060,1061],{"style":527},"  end",[482,1063,1064],{"class":484,"style":485},[482,1065,644],{"style":527},[108,1067,1068],{},"The columns serve specific purposes:",[226,1070,1071,1077,1083,1089],{},[229,1072,1073,1076],{},[384,1074,1075],{},"external_id",": The credential ID from the authenticator (used to look up which credential the user is presenting)",[229,1078,1079,1082],{},[384,1080,1081],{},"public_key",": The cryptographic public key for verifying signatures",[229,1084,1085,1088],{},[384,1086,1087],{},"sign_count",": Tracks how many times this credential has been used (helps detect cloned authenticators)",[229,1090,1091,1094],{},[384,1092,1093],{},"nickname",": A human-readable name set by the user to identify their passkeys (e.g., \"MacBook Pro\", \"Blue YubiKey\").",[108,1096,1097,1098,1101],{},"We also need a ",[384,1099,1100],{},"web_authn_id"," on the User model:",[474,1103,1104],{"language":476,"class":477},[384,1105,1106,490,1111,490,1128,490,1134,490,1152,490,1168,490,1172],{"class":480},[482,1107,1108],{"class":484,"style":485},[482,1109,1110],{"style":488},"# db\u002Fmigrate\u002Fadd_web_authn_id_to_users.rb",[482,1112,1113,1115,1118,1120,1122,1124,1126],{"class":484,"style":485},[482,1114,846],{"style":527},[482,1116,1117],{"style":745}," AddWebAuthnIdToUsers",[482,1119,852],{"style":495},[482,1121,855],{"style":517},[482,1123,858],{"style":495},[482,1125,861],{"style":517},[482,1127,864],{"style":495},[482,1129,1130,1132],{"class":484,"style":485},[482,1131,869],{"style":527},[482,1133,872],{"style":523},[482,1135,1136,1139,1142,1144,1147,1149],{"class":484,"style":485},[482,1137,1138],{"style":495},"    add_column ",[482,1140,1141],{"style":517},":users",[482,1143,443],{"style":495},[482,1145,1146],{"style":517},":web_authn_id",[482,1148,443],{"style":495},[482,1150,1151],{"style":517},":string",[482,1153,1154,1156,1158,1160,1162,1164,1166],{"class":484,"style":485},[482,1155,1018],{"style":495},[482,1157,1141],{"style":517},[482,1159,443],{"style":495},[482,1161,1146],{"style":517},[482,1163,443],{"style":495},[482,1165,1030],{"style":517},[482,1167,920],{"style":517},[482,1169,1170],{"class":484,"style":485},[482,1171,1061],{"style":527},[482,1173,1174],{"class":484,"style":485},[482,1175,644],{"style":527},[108,1177,1178],{},"This is a random identifier the WebAuthn spec requires. It's not your user's database ID. The spec recommends a random value to prevent tracking users across sites.",[290,1180,61],{"id":60},[474,1182,1183],{"language":476,"class":477},[384,1184,1185,490,1190,490,1202,490,1210,490,1212,490,1233,490,1246,490,1274,490,1290,490,1298,490,1307,490,1316,490,1341,490,1346],{"class":480},[482,1186,1187],{"class":484,"style":485},[482,1188,1189],{"style":488},"# app\u002Fmodels\u002Fweb_authn_credential.rb",[482,1191,1192,1194,1197,1199],{"class":484,"style":485},[482,1193,846],{"style":527},[482,1195,1196],{"style":745}," WebAuthnCredential",[482,1198,852],{"style":495},[482,1200,1201],{"style":517},"ApplicationRecord",[482,1203,1204,1207],{"class":484,"style":485},[482,1205,1206],{"style":495},"  belongs_to ",[482,1208,1209],{"style":517},":user",[482,1211],{"class":484,"style":485},[482,1213,1214,1217,1219,1221,1224,1226,1228,1231],{"class":484,"style":485},[482,1215,1216],{"style":495},"  validates ",[482,1218,1025],{"style":517},[482,1220,443],{"style":495},[482,1222,1223],{"style":517},"presence:",[482,1225,920],{"style":517},[482,1227,443],{"style":495},[482,1229,1230],{"style":517},"uniqueness:",[482,1232,920],{"style":517},[482,1234,1235,1237,1240,1242,1244],{"class":484,"style":485},[482,1236,1216],{"style":495},[482,1238,1239],{"style":517},":public_key",[482,1241,443],{"style":495},[482,1243,1223],{"style":517},[482,1245,920],{"style":517},[482,1247,1248,1250,1252,1254,1256,1258,1260,1262,1265,1268,1271],{"class":484,"style":485},[482,1249,1216],{"style":495},[482,1251,1044],{"style":517},[482,1253,443],{"style":495},[482,1255,1223],{"style":517},[482,1257,920],{"style":517},[482,1259,443],{"style":495},[482,1261,1230],{"style":517},[482,1263,1264],{"style":495}," { ",[482,1266,1267],{"style":517},"scope:",[482,1269,1270],{"style":517}," :user_id",[482,1272,1273],{"style":495}," }",[482,1275,1276,1278,1281,1283,1285,1287],{"class":484,"style":485},[482,1277,1216],{"style":495},[482,1279,1280],{"style":517},":sign_count",[482,1282,443],{"style":495},[482,1284,1223],{"style":517},[482,1286,920],{"style":517},[482,1288,1289],{"style":495},",",[482,1291,1292,1295],{"class":484,"style":485},[482,1293,1294],{"style":517},"                         numericality:",[482,1296,1297],{"style":495}," {",[482,1299,1300,1303,1305],{"class":484,"style":485},[482,1301,1302],{"style":517},"                           only_integer:",[482,1304,920],{"style":517},[482,1306,1289],{"style":495},[482,1308,1309,1312,1314],{"class":484,"style":485},[482,1310,1311],{"style":517},"                           greater_than_or_equal_to:",[482,1313,997],{"style":517},[482,1315,1289],{"style":495},[482,1317,1318,1321,1324,1326,1329,1332,1335,1338],{"class":484,"style":485},[482,1319,1320],{"style":517},"                           less_than_or_equal_to:",[482,1322,1323],{"style":495}," (",[482,1325,152],{"style":517},[482,1327,1328],{"style":527},"**",[482,1330,1331],{"style":517},"32",[482,1333,1334],{"style":495},") ",[482,1336,1337],{"style":527},"-",[482,1339,1340],{"style":517}," 1",[482,1342,1343],{"class":484,"style":485},[482,1344,1345],{"style":495},"                         }",[482,1347,1348],{"class":484,"style":485},[482,1349,644],{"style":527},[108,1351,1352,1353,1356,1357,1359,1360,1362],{},"Standard validations. The sign_count upper bound (",[384,1354,1355],{},"2**32 - 1",") matches the WebAuthn spec, which defines it as a 32-bit unsigned integer. The ",[384,1358,1075],{}," must be globally unique (it comes from the authenticator). The ",[384,1361,1093],{}," only needs to be unique per user.",[290,1364,64],{"id":63},[108,1366,1367],{},"Add the association and a helper method:",[474,1369,1370],{"language":476,"class":477},[384,1371,1372,490,1377,490,1388,490,1403,490,1405,490,1424,490,1426,490,1433,490,1441,490,1445],{"class":480},[482,1373,1374],{"class":484,"style":485},[482,1375,1376],{"style":488},"# app\u002Fmodels\u002Fuser.rb",[482,1378,1379,1381,1384,1386],{"class":484,"style":485},[482,1380,846],{"style":527},[482,1382,1383],{"style":745}," User",[482,1385,852],{"style":495},[482,1387,1201],{"style":517},[482,1389,1390,1393,1395,1397,1400],{"class":484,"style":485},[482,1391,1392],{"style":495},"  has_many ",[482,1394,880],{"style":517},[482,1396,443],{"style":495},[482,1398,1399],{"style":517},"dependent:",[482,1401,1402],{"style":517}," :destroy",[482,1404],{"class":484,"style":485},[482,1406,1407,1409,1411,1413,1415,1417,1419,1422],{"class":484,"style":485},[482,1408,1216],{"style":495},[482,1410,1146],{"style":517},[482,1412,443],{"style":495},[482,1414,1230],{"style":517},[482,1416,920],{"style":517},[482,1418,443],{"style":495},[482,1420,1421],{"style":517},"allow_nil:",[482,1423,920],{"style":517},[482,1425],{"class":484,"style":485},[482,1427,1428,1430],{"class":484,"style":485},[482,1429,869],{"style":527},[482,1431,1432],{"style":523}," web_authn_enabled?",[482,1434,1435,1438],{"class":484,"style":485},[482,1436,1437],{"style":495},"    web_authn_credentials.",[482,1439,1440],{"style":523},"exists?",[482,1442,1443],{"class":484,"style":485},[482,1444,1061],{"style":527},[482,1446,1447],{"class":484,"style":485},[482,1448,644],{"style":527},[108,1450,650,1451,1454],{},[384,1452,1453],{},"web_authn_enabled?"," method is used to enforce the appropriate authentication path for each user.",[220,1456,67],{"id":66},[108,1458,1459],{},"We implemented password-full registration first. This lets users add passkeys as a second factor while still relying on passwords as the primary authentication. It was our way of evaluating both implementation styles side-by-side before committing to the more streamlined password-less approach.",[108,1461,1462],{},[298,1463],{"src":1464},"\u002Fimages\u002Fblog\u002Fwebauthn-rails-setup-passkey-registration-3.webp",[108,1466,1467],{},"The registration flow works like this:",[1469,1470,1471,1474,1477,1480,1483,1486,1489],"ol",{},[229,1472,1473],{},"User clicks \"Add passkey\" in their profile (they're already authenticated)",[229,1475,1476],{},"Frontend requests registration options from the server",[229,1478,1479],{},"Server generates a challenge and returns it with user info",[229,1481,1482],{},"Frontend triggers the browser's WebAuthn ceremony",[229,1484,1485],{},"User interacts with their authenticator (fingerprint, Face ID, etc.)",[229,1487,1488],{},"Frontend sends the credential response to the server",[229,1490,1491],{},"Server verifies and stores the credential",[290,1493,71],{"id":70},[108,1495,1496],{},"Let's start with the routes we need:",[474,1498,1499],{"language":476,"class":477},[384,1500,1501,490,1506,490,1516,490,1526,490,1542,490,1546,490,1548,490,1562],{"class":480},[482,1502,1503],{"class":484,"style":485},[482,1504,1505],{"style":488},"# config\u002Froutes.rb",[482,1507,1508,1511,1514],{"class":484,"style":485},[482,1509,1510],{"style":495},"namespace ",[482,1512,1513],{"style":517},":web_authn",[482,1515,528],{"style":527},[482,1517,1518,1521,1524],{"class":484,"style":485},[482,1519,1520],{"style":495},"  namespace ",[482,1522,1523],{"style":517},":credentials",[482,1525,528],{"style":527},[482,1527,1528,1531,1534,1536,1539],{"class":484,"style":485},[482,1529,1530],{"style":495},"    resource ",[482,1532,1533],{"style":517},":options",[482,1535,443],{"style":495},[482,1537,1538],{"style":517},"only:",[482,1540,1541],{"style":517}," :create",[482,1543,1544],{"class":484,"style":485},[482,1545,1061],{"style":527},[482,1547],{"class":484,"style":485},[482,1549,1550,1553,1555,1557,1559],{"class":484,"style":485},[482,1551,1552],{"style":495},"  resources ",[482,1554,1523],{"style":517},[482,1556,443],{"style":495},[482,1558,1538],{"style":517},[482,1560,1561],{"style":517}," %i[create destroy]",[482,1563,1564],{"class":484,"style":485},[482,1565,644],{"style":527},[108,1567,1568],{},"This gives us:",[226,1570,1571,1577,1583],{},[229,1572,1573,1576],{},[384,1574,1575],{},"POST \u002Fweb_authn\u002Fcredentials\u002Foptions"," - Get registration options",[229,1578,1579,1582],{},[384,1580,1581],{},"POST \u002Fweb_authn\u002Fcredentials"," - Create a new credential",[229,1584,1585,1588],{},[384,1586,1587],{},"DELETE \u002Fweb_authn\u002Fcredentials\u002F:id"," - Remove a credential",[290,1590,74],{"id":73},[108,1592,1593],{},"Before a user can register a passkey, we need to generate registration options. This includes a random challenge that prevents replay attacks:",[474,1595,1596],{"language":476,"class":477},[384,1597,1598,490,1603,490,1615,490,1622,490,1627,490,1629,490,1652,490,1659,490,1671,490,1683,490,1692,490,1697,490,1718,490,1725,490,1735,490,1742,490,1747,490,1752,490,1754,490,1777,490,1779,490,1790,490,1794,490,1796,490,1801,490,1803,490,1810,490,1846,490,1850],{"class":480},[482,1599,1600],{"class":484,"style":485},[482,1601,1602],{"style":488},"# app\u002Fcontrollers\u002Fweb_authn\u002Fcredentials\u002Foptions_controller.rb",[482,1604,1605,1607,1610,1612],{"class":484,"style":485},[482,1606,846],{"style":527},[482,1608,1609],{"style":745}," WebAuthn::Credentials::OptionsController",[482,1611,852],{"style":495},[482,1613,1614],{"style":517},"ApplicationController",[482,1616,1617,1619],{"class":484,"style":485},[482,1618,869],{"style":527},[482,1620,1621],{"style":523}," create",[482,1623,1624],{"class":484,"style":485},[482,1625,1626],{"style":495},"    generate_user_web_authn_id",[482,1628],{"class":484,"style":485},[482,1630,1631,1634,1636,1639,1641,1643,1645,1647,1650],{"class":484,"style":485},[482,1632,1633],{"style":745},"    options",[482,1635,542],{"style":527},[482,1637,1638],{"style":495}," ::",[482,1640,518],{"style":517},[482,1642,702],{"style":495},[482,1644,380],{"style":517},[482,1646,285],{"style":495},[482,1648,1649],{"style":523},"options_for_create",[482,1651,553],{"style":495},[482,1653,1654,1657],{"class":484,"style":485},[482,1655,1656],{"style":517},"      user:",[482,1658,1297],{"style":495},[482,1660,1661,1664,1667,1669],{"class":484,"style":485},[482,1662,1663],{"style":517},"        id:",[482,1665,1666],{"style":495}," current_user.",[482,1668,1100],{"style":523},[482,1670,1289],{"style":495},[482,1672,1673,1676,1678,1681],{"class":484,"style":485},[482,1674,1675],{"style":517},"        name:",[482,1677,1666],{"style":495},[482,1679,1680],{"style":523},"email",[482,1682,1289],{"style":495},[482,1684,1685,1688,1690],{"class":484,"style":485},[482,1686,1687],{"style":517},"        display_name:",[482,1689,1666],{"style":495},[482,1691,1680],{"style":523},[482,1693,1694],{"class":484,"style":485},[482,1695,1696],{"style":495},"      },",[482,1698,1699,1702,1704,1707,1709,1712,1714,1716],{"class":484,"style":485},[482,1700,1701],{"style":517},"      exclude:",[482,1703,1666],{"style":495},[482,1705,1706],{"style":523},"web_authn_credentials",[482,1708,285],{"style":495},[482,1710,1711],{"style":523},"pluck",[482,1713,553],{"style":495},[482,1715,1025],{"style":517},[482,1717,600],{"style":495},[482,1719,1720,1723],{"class":484,"style":485},[482,1721,1722],{"style":517},"      authenticator_selection:",[482,1724,1297],{"style":495},[482,1726,1727,1730,1733],{"class":484,"style":485},[482,1728,1729],{"style":517},"        resident_key:",[482,1731,1732],{"style":499}," 'discouraged'",[482,1734,1289],{"style":495},[482,1736,1737,1740],{"class":484,"style":485},[482,1738,1739],{"style":517},"        user_verification:",[482,1741,1732],{"style":499},[482,1743,1744],{"class":484,"style":485},[482,1745,1746],{"style":495},"      }",[482,1748,1749],{"class":484,"style":485},[482,1750,1751],{"style":495},"    )",[482,1753],{"class":484,"style":485},[482,1755,1756,1759,1761,1763,1765,1768,1771,1774],{"class":484,"style":485},[482,1757,1758],{"style":495},"    session[",[482,1760,518],{"style":517},[482,1762,702],{"style":495},[482,1764,719],{"style":517},[482,1766,1767],{"style":495},"] ",[482,1769,1770],{"style":527},"=",[482,1772,1773],{"style":495}," options.",[482,1775,1776],{"style":523},"challenge",[482,1778],{"class":484,"style":485},[482,1780,1781,1784,1787],{"class":484,"style":485},[482,1782,1783],{"style":495},"    render ",[482,1785,1786],{"style":517},"json:",[482,1788,1789],{"style":495}," options",[482,1791,1792],{"class":484,"style":485},[482,1793,1061],{"style":527},[482,1795],{"class":484,"style":485},[482,1797,1798],{"class":484,"style":485},[482,1799,1800],{"style":527},"  private",[482,1802],{"class":484,"style":485},[482,1804,1805,1807],{"class":484,"style":485},[482,1806,869],{"style":527},[482,1808,1809],{"style":523}," generate_user_web_authn_id",[482,1811,1812,1815,1818,1820,1823,1825,1827,1829,1832,1834,1837,1839,1841,1843],{"class":484,"style":485},[482,1813,1814],{"style":495},"    current_user.",[482,1816,1817],{"style":523},"update!",[482,1819,553],{"style":495},[482,1821,1822],{"style":517},"web_authn_id:",[482,1824,1638],{"style":495},[482,1826,518],{"style":517},[482,1828,285],{"style":495},[482,1830,1831],{"style":523},"generate_user_id",[482,1833,1334],{"style":495},[482,1835,1836],{"style":527},"if",[482,1838,1666],{"style":495},[482,1840,1100],{"style":523},[482,1842,285],{"style":495},[482,1844,1845],{"style":523},"blank?",[482,1847,1848],{"class":484,"style":485},[482,1849,1061],{"style":527},[482,1851,1852],{"class":484,"style":485},[482,1853,644],{"style":527},[108,1855,1856],{},"Let's break this down piece by piece.",[108,1858,1859,1860,1862],{},"First, we ensure the user has a ",[384,1861,1100],{},". This only happens once, on their first registration attempt:",[474,1864,1865],{"language":476,"class":477},[384,1866,1867],{"class":480},[482,1868,1869,1872,1874,1876,1878,1880,1882,1884,1886,1888,1890,1892,1894,1896],{"class":484,"style":485},[482,1870,1871],{"style":495},"current_user.",[482,1873,1817],{"style":523},[482,1875,553],{"style":495},[482,1877,1822],{"style":517},[482,1879,1638],{"style":495},[482,1881,518],{"style":517},[482,1883,285],{"style":495},[482,1885,1831],{"style":523},[482,1887,1334],{"style":495},[482,1889,1836],{"style":527},[482,1891,1666],{"style":495},[482,1893,1100],{"style":523},[482,1895,285],{"style":495},[482,1897,1845],{"style":523},[108,1899,1900,1901,1903,1904,1907],{},"Then we call ",[384,1902,1649],{}," with the user's information. The ",[384,1905,1906],{},"exclude"," parameter is important. It prevents users from registering the same authenticator twice by listing credential IDs they've already registered:",[474,1909,1910],{"language":476,"class":477},[384,1911,1912],{"class":480},[482,1913,1914,1917,1919,1921,1923,1925,1927,1929],{"class":484,"style":485},[482,1915,1916],{"style":517},"exclude:",[482,1918,1666],{"style":495},[482,1920,1706],{"style":523},[482,1922,285],{"style":495},[482,1924,1711],{"style":523},[482,1926,553],{"style":495},[482,1928,1025],{"style":517},[482,1930,564],{"style":495},[108,1932,650,1933,1936],{},[384,1934,1935],{},"authenticator_selection"," options control what kind of credential gets created:",[226,1938,1939,1945],{},[229,1940,1941,1944],{},[384,1942,1943],{},"resident_key: 'discouraged'"," tells the authenticator not to store the user's identity on the device. Since we're using an email-first flow (users enter their email, then we look up their credentials), we don't need discoverable credentials. This also saves limited storage on hardware security keys.",[229,1946,1947,1950,1951,285],{},[384,1948,1949],{},"user_verification: 'discouraged'"," means the authenticator only needs to test presence (a touch), not verify the user's identity with a PIN or biometric. For 2FA, this makes sense because the password already proves \"something you know\". We'll change this when we implement password-less in ",[156,1952,1953],{"href":158},"Part 2",[108,1955,1956],{},"Finally, we store the challenge in the session. We'll verify this challenge when the credential comes back from the browser:",[474,1958,1959],{"language":476,"class":477},[384,1960,1961],{"class":480},[482,1962,1963,1966,1968,1970,1972,1974,1976,1978],{"class":484,"style":485},[482,1964,1965],{"style":495},"session[",[482,1967,518],{"style":517},[482,1969,702],{"style":495},[482,1971,719],{"style":517},[482,1973,1767],{"style":495},[482,1975,1770],{"style":527},[482,1977,1773],{"style":495},[482,1979,1776],{"style":523},[290,1981,77],{"id":76},[108,1983,1984],{},"Now for the controller that stores and removes credentials. We'll show a simplified version first that uses redirects.",[108,1986,1987,1990,1991,1994],{},[139,1988,1989],{},"Heads up",": In ",[156,1992,1993],{"href":169},"Part 3",", we'll significantly refactor this controller to return JSON instead of redirecting. This is needed to return backup codes to the frontend when users register their first passkey. The registration modal will also need updates to handle JSON responses. For now, this redirect-based version works fine for registration without backup codes.",[474,1996,1997],{"language":476,"class":477},[384,1998,1999,490,2004,490,2015,490,2029,490,2031,490,2037,490,2047,490,2058,490,2060,490,2073,490,2075,490,2086,490,2091,490,2096,490,2110,490,2114,490,2118,490,2120,490,2127,490,2150,490,2161,490,2165,490,2167,490,2171,490,2173,490,2179,490,2206,490,2225,490,2229,490,2246,490,2264,490,2289,490,2294,490,2298,490,2300,490,2308,490,2321,490,2334,490,2345,490,2358,490,2367,490,2371,490,2375,490,2377,490,2384,490,2400,490,2409,490,2413],{"class":480},[482,2000,2001],{"class":484,"style":485},[482,2002,2003],{"style":488},"# app\u002Fcontrollers\u002Fweb_authn\u002Fcredentials_controller.rb",[482,2005,2006,2008,2011,2013],{"class":484,"style":485},[482,2007,846],{"style":527},[482,2009,2010],{"style":745}," WebAuthn::CredentialsController",[482,2012,852],{"style":495},[482,2014,1614],{"style":517},[482,2016,2017,2020,2023,2025,2027],{"class":484,"style":485},[482,2018,2019],{"style":495},"  skip_before_action ",[482,2021,2022],{"style":517},":underscore_params",[482,2024,443],{"style":495},[482,2026,1538],{"style":517},[482,2028,1541],{"style":517},[482,2030],{"class":484,"style":485},[482,2032,2033,2035],{"class":484,"style":485},[482,2034,869],{"style":527},[482,2036,1621],{"style":523},[482,2038,2039,2042,2044],{"class":484,"style":485},[482,2040,2041],{"style":745},"    web_authn_credential",[482,2043,542],{"style":527},[482,2045,2046],{"style":495}," verify_web_authn_credential",[482,2048,2049,2052,2055],{"class":484,"style":485},[482,2050,2051],{"style":527},"    return",[482,2053,2054],{"style":527}," unless",[482,2056,2057],{"style":495}," web_authn_credential",[482,2059],{"class":484,"style":485},[482,2061,2062,2065,2067,2070],{"class":484,"style":485},[482,2063,2064],{"style":495},"    @credential ",[482,2066,1770],{"style":527},[482,2068,2069],{"style":523}," build_web_authn_credential",[482,2071,2072],{"style":495},"(web_authn_credential)",[482,2074],{"class":484,"style":485},[482,2076,2077,2080,2083],{"class":484,"style":485},[482,2078,2079],{"style":527},"    if",[482,2081,2082],{"style":495}," @credential.",[482,2084,2085],{"style":523},"save",[482,2087,2088],{"class":484,"style":485},[482,2089,2090],{"style":495},"      handle_successful_registration",[482,2092,2093],{"class":484,"style":485},[482,2094,2095],{"style":527},"    else",[482,2097,2098,2101,2104,2107],{"class":484,"style":485},[482,2099,2100],{"style":495},"      redirect_to users_security_path, ",[482,2102,2103],{"style":517},"inertia:",[482,2105,2106],{"style":523}," inertia_errors",[482,2108,2109],{"style":495},"(@credential)",[482,2111,2112],{"class":484,"style":485},[482,2113,1011],{"style":527},[482,2115,2116],{"class":484,"style":485},[482,2117,1061],{"style":527},[482,2119],{"class":484,"style":485},[482,2121,2122,2124],{"class":484,"style":485},[482,2123,869],{"style":527},[482,2125,2126],{"style":523}," destroy",[482,2128,2129,2131,2133,2135,2138,2141,2144,2147],{"class":484,"style":485},[482,2130,1814],{"style":495},[482,2132,1706],{"style":523},[482,2134,285],{"style":495},[482,2136,2137],{"style":523},"find",[482,2139,2140],{"style":495},"(params[",[482,2142,2143],{"style":517},":id",[482,2145,2146],{"style":495},"]).",[482,2148,2149],{"style":523},"destroy!",[482,2151,2152,2155,2158],{"class":484,"style":485},[482,2153,2154],{"style":495},"    redirect_to users_security_path, ",[482,2156,2157],{"style":517},"notice:",[482,2159,2160],{"style":499}," 'Passkey removed successfully'",[482,2162,2163],{"class":484,"style":485},[482,2164,1061],{"style":527},[482,2166],{"class":484,"style":485},[482,2168,2169],{"class":484,"style":485},[482,2170,1800],{"style":527},[482,2172],{"class":484,"style":485},[482,2174,2175,2177],{"class":484,"style":485},[482,2176,869],{"style":527},[482,2178,2046],{"style":523},[482,2180,2181,2183,2185,2187,2189,2191,2193,2195,2198,2200,2203],{"class":484,"style":485},[482,2182,2041],{"style":745},[482,2184,542],{"style":527},[482,2186,1638],{"style":495},[482,2188,518],{"style":517},[482,2190,702],{"style":495},[482,2192,380],{"style":517},[482,2194,285],{"style":495},[482,2196,2197],{"style":523},"from_create",[482,2199,2140],{"style":495},[482,2201,2202],{"style":517},":credential",[482,2204,2205],{"style":495},"])",[482,2207,2208,2211,2214,2217,2219,2221,2223],{"class":484,"style":485},[482,2209,2210],{"style":495},"    web_authn_credential.",[482,2212,2213],{"style":523},"verify",[482,2215,2216],{"style":495},"(session[",[482,2218,518],{"style":517},[482,2220,702],{"style":495},[482,2222,719],{"style":517},[482,2224,2205],{"style":495},[482,2226,2227],{"class":484,"style":485},[482,2228,2041],{"style":495},[482,2230,2231,2234,2236,2238,2240,2243],{"class":484,"style":485},[482,2232,2233],{"style":527},"  rescue",[482,2235,1638],{"style":495},[482,2237,518],{"style":517},[482,2239,702],{"style":495},[482,2241,2242],{"style":517},"Error",[482,2244,2245],{"style":495}," => e",[482,2247,2248,2251,2254,2256,2258,2260,2262],{"class":484,"style":485},[482,2249,2250],{"style":495},"    session.",[482,2252,2253],{"style":523},"delete",[482,2255,553],{"style":495},[482,2257,518],{"style":517},[482,2259,702],{"style":495},[482,2261,719],{"style":517},[482,2263,564],{"style":495},[482,2265,2266,2268,2271,2274,2277,2280,2283,2286],{"class":484,"style":485},[482,2267,2154],{"style":495},[482,2269,2270],{"style":517},"alert:",[482,2272,2273],{"style":499}," \"Registration failed: ",[482,2275,2276],{"style":527},"#{",[482,2278,2279],{"style":499},"e.",[482,2281,2282],{"style":523},"message",[482,2284,2285],{"style":527},"}",[482,2287,2288],{"style":499},"\"",[482,2290,2291],{"class":484,"style":485},[482,2292,2293],{"style":517},"    nil",[482,2295,2296],{"class":484,"style":485},[482,2297,1061],{"style":527},[482,2299],{"class":484,"style":485},[482,2301,2302,2304,2306],{"class":484,"style":485},[482,2303,869],{"style":527},[482,2305,2069],{"style":523},[482,2307,2072],{"style":495},[482,2309,2310,2312,2314,2316,2319],{"class":484,"style":485},[482,2311,1814],{"style":495},[482,2313,1706],{"style":523},[482,2315,285],{"style":495},[482,2317,2318],{"style":523},"build",[482,2320,553],{"style":495},[482,2322,2323,2326,2329,2332],{"class":484,"style":485},[482,2324,2325],{"style":517},"      external_id:",[482,2327,2328],{"style":495}," web_authn_credential.",[482,2330,2331],{"style":523},"id",[482,2333,1289],{"style":495},[482,2335,2336,2339,2341,2343],{"class":484,"style":485},[482,2337,2338],{"style":517},"      public_key:",[482,2340,2328],{"style":495},[482,2342,1081],{"style":523},[482,2344,1289],{"style":495},[482,2346,2347,2350,2353,2355],{"class":484,"style":485},[482,2348,2349],{"style":517},"      nickname:",[482,2351,2352],{"style":495}," params[",[482,2354,1044],{"style":517},[482,2356,2357],{"style":495},"],",[482,2359,2360,2363,2365],{"class":484,"style":485},[482,2361,2362],{"style":517},"      sign_count:",[482,2364,2328],{"style":495},[482,2366,1087],{"style":523},[482,2368,2369],{"class":484,"style":485},[482,2370,1751],{"style":495},[482,2372,2373],{"class":484,"style":485},[482,2374,1061],{"style":527},[482,2376],{"class":484,"style":485},[482,2378,2379,2381],{"class":484,"style":485},[482,2380,869],{"style":527},[482,2382,2383],{"style":523}," handle_successful_registration",[482,2385,2386,2388,2390,2392,2394,2396,2398],{"class":484,"style":485},[482,2387,2250],{"style":495},[482,2389,2253],{"style":523},[482,2391,553],{"style":495},[482,2393,518],{"style":517},[482,2395,702],{"style":495},[482,2397,719],{"style":517},[482,2399,564],{"style":495},[482,2401,2402,2404,2406],{"class":484,"style":485},[482,2403,2154],{"style":495},[482,2405,2157],{"style":517},[482,2407,2408],{"style":499}," 'Passkey registered successfully'",[482,2410,2411],{"class":484,"style":485},[482,2412,1061],{"style":527},[482,2414,2415],{"class":484,"style":485},[482,2416,644],{"style":527},[108,2418,2419],{},"Let's walk through each piece.",[108,2421,650,2422,2425,2426,2429],{},[384,2423,2424],{},"create"," action coordinates three steps: verify the credential, build the record, handle the result. We extract these into private methods to keep the action readable. If validation fails, we use ",[384,2427,2428],{},"inertia_errors(@credential)"," to pass ActiveRecord errors to the frontend in a format Inertia.js understands:",[474,2431,2432],{"language":476,"class":477},[384,2433,2434,490,2439,490,2449,490,2454,490,2491,490,2496],{"class":480},[482,2435,2436],{"class":484,"style":485},[482,2437,2438],{"style":488},"# app\u002Fcontrollers\u002Fconcerns\u002Finertia_config.rb",[482,2440,2441,2444,2446],{"class":484,"style":485},[482,2442,2443],{"style":527},"def",[482,2445,2106],{"style":523},[482,2447,2448],{"style":495},"(resource)",[482,2450,2451],{"class":484,"style":485},[482,2452,2453],{"style":495},"  {",[482,2455,2456,2459,2462,2465,2467,2470,2472,2475,2478,2481,2483,2486,2489],{"class":484,"style":485},[482,2457,2458],{"style":517},"    errors:",[482,2460,2461],{"style":495}," resource.",[482,2463,2464],{"style":523},"errors",[482,2466,285],{"style":495},[482,2468,2469],{"style":523},"to_hash",[482,2471,553],{"style":495},[482,2473,2474],{"style":517},"true",[482,2476,2477],{"style":495},").",[482,2479,2480],{"style":523},"transform_values",[482,2482,553],{"style":495},[482,2484,2485],{"style":527},"&",[482,2487,2488],{"style":517},":first",[482,2490,564],{"style":495},[482,2492,2493],{"class":484,"style":485},[482,2494,2495],{"style":495},"  }",[482,2497,2498],{"class":484,"style":485},[482,2499,644],{"style":527},[108,2501,2502,2503,2506,2507,2510],{},"This transforms ActiveRecord's errors hash into ",[384,2504,2505],{},"{ errors: { nickname: \"Nickname can't be blank\" } }",". Inertia picks this up and populates ",[384,2508,2509],{},"form.errors"," on the frontend (will be discussed later).",[108,2512,2513,2516],{},[384,2514,2515],{},"verify_web_authn_credential"," parses the credential response from the browser and verifies it against the challenge we stored earlier:",[474,2518,2519],{"language":476,"class":477},[384,2520,2521,490,2546],{"class":480},[482,2522,2523,2526,2528,2530,2532,2534,2536,2538,2540,2542,2544],{"class":484,"style":485},[482,2524,2525],{"style":745},"web_authn_credential",[482,2527,542],{"style":527},[482,2529,1638],{"style":495},[482,2531,518],{"style":517},[482,2533,702],{"style":495},[482,2535,380],{"style":517},[482,2537,285],{"style":495},[482,2539,2197],{"style":523},[482,2541,2140],{"style":495},[482,2543,2202],{"style":517},[482,2545,2205],{"style":495},[482,2547,2548,2551,2553,2555,2557,2559,2561],{"class":484,"style":485},[482,2549,2550],{"style":495},"web_authn_credential.",[482,2552,2213],{"style":523},[482,2554,2216],{"style":495},[482,2556,518],{"style":517},[482,2558,702],{"style":495},[482,2560,719],{"style":517},[482,2562,2205],{"style":495},[108,2564,2565,2566,2568,2569,2572],{},"If verification fails, the ",[384,2567,456],{}," gem raises a ",[384,2570,2571],{},"WebAuthn::Error",". We catch it and redirect with an alert message.",[108,2574,2575,2578],{},[384,2576,2577],{},"build_web_authn_credential"," creates the record with the verified data.",[108,2580,2581,2584],{},[384,2582,2583],{},"handle_successful_registration"," cleans up the session, and redirects with a success message. We'll expand this method significantly when we add backup codes.",[108,2586,650,2587,2590],{},[384,2588,2589],{},"destroy"," action lets users remove passkeys they no longer want. This is straightforward, but we'll add cleanup logic later when we implement backup codes.",[290,2592,80],{"id":79},[108,2594,2595,2596,2599,2600,2603,2604,2477],{},"All passkey registration management happens on a dedicated security settings page. This page renders the ",[384,2597,2598],{},"WebAuthnCredentials"," component (for listing and adding passkeys) and the ",[384,2601,2602],{},"BackupCodesCard"," component (for viewing remaining codes and regenerating them, which will be added in ",[156,2605,1993],{"href":169},[108,2607,2608],{},"Add the route:",[474,2610,2611],{"language":476,"class":477},[384,2612,2613,490,2617,490,2625,490,2648],{"class":480},[482,2614,2615],{"class":484,"style":485},[482,2616,1505],{"style":488},[482,2618,2619,2621,2623],{"class":484,"style":485},[482,2620,1510],{"style":495},[482,2622,1141],{"style":517},[482,2624,528],{"style":527},[482,2626,2627,2630,2633,2635,2637,2640,2642,2645],{"class":484,"style":485},[482,2628,2629],{"style":495},"  resource ",[482,2631,2632],{"style":517},":security",[482,2634,443],{"style":495},[482,2636,1538],{"style":517},[482,2638,2639],{"style":517}," :show",[482,2641,443],{"style":495},[482,2643,2644],{"style":517},"controller:",[482,2646,2647],{"style":499}," 'security'",[482,2649,2650],{"class":484,"style":485},[482,2651,644],{"style":527},[108,2653,2654],{},"The controller is straightforward:",[474,2656,2657],{"language":476,"class":477},[384,2658,2659,490,2664,490,2675,490,2682,490,2698,490,2707,490,2730,490,2747,490,2752,490,2756],{"class":480},[482,2660,2661],{"class":484,"style":485},[482,2662,2663],{"style":488},"# app\u002Fcontrollers\u002Fusers\u002Fsecurity_controller.rb",[482,2665,2666,2668,2671,2673],{"class":484,"style":485},[482,2667,846],{"style":527},[482,2669,2670],{"style":745}," Users::SecurityController",[482,2672,852],{"style":495},[482,2674,1614],{"style":517},[482,2676,2677,2679],{"class":484,"style":485},[482,2678,869],{"style":527},[482,2680,2681],{"style":523}," show",[482,2683,2684,2686,2688,2691,2693,2696],{"class":484,"style":485},[482,2685,1783],{"style":495},[482,2687,2103],{"style":517},[482,2689,2690],{"style":499}," 'users\u002FSecurity'",[482,2692,443],{"style":495},[482,2694,2695],{"style":517},"props:",[482,2697,1297],{"style":495},[482,2699,2700,2703,2705],{"class":484,"style":485},[482,2701,2702],{"style":517},"      web_authn_credentials:",[482,2704,1666],{"style":495},[482,2706,1706],{"style":523},[482,2708,2709,2712,2715,2717,2719,2721,2723,2725,2728],{"class":484,"style":485},[482,2710,2711],{"style":495},"                                         .",[482,2713,2714],{"style":517},"select",[482,2716,553],{"style":495},[482,2718,2143],{"style":517},[482,2720,443],{"style":495},[482,2722,1044],{"style":517},[482,2724,443],{"style":495},[482,2726,2727],{"style":517},":created_at",[482,2729,564],{"style":495},[482,2731,2732,2734,2737,2739,2742,2745],{"class":484,"style":485},[482,2733,2711],{"style":495},[482,2735,2736],{"style":523},"order",[482,2738,553],{"style":495},[482,2740,2741],{"style":517},"created_at:",[482,2743,2744],{"style":517}," :desc",[482,2746,564],{"style":495},[482,2748,2749],{"class":484,"style":485},[482,2750,2751],{"style":495},"    }",[482,2753,2754],{"class":484,"style":485},[482,2755,1061],{"style":527},[482,2757,2758],{"class":484,"style":485},[482,2759,644],{"style":527},[108,2761,2762],{},"The frontend receives the user's existing credentials to display in a list. The actual credential management happens through the WebAuthn controllers we just built.",[108,2764,2765],{},"The separation from the main profile page is intentional. Security settings deserve their own space. Users looking for their passkeys shouldn't have to scroll past name and email fields.",[290,2767,83],{"id":82},[108,2769,2770],{},"Here's something that tripped us up. Our app uses Inertia.js, and we have a concern that transforms incoming parameters from camelCase to snake_case:",[474,2772,2773],{"language":476,"class":477},[384,2774,2775,490,2779,490,2787,490,2800,490,2802,490,2810,490,2817,490,2821,490,2823,490,2827,490,2829,490,2836,490,2857,490,2861],{"class":480},[482,2776,2777],{"class":484,"style":485},[482,2778,2438],{"style":488},[482,2780,2781,2784],{"class":484,"style":485},[482,2782,2783],{"style":527},"module",[482,2785,2786],{"style":745}," InertiaConfig",[482,2788,2789,2792,2795,2797],{"class":484,"style":485},[482,2790,2791],{"style":527},"  extend",[482,2793,2794],{"style":517}," ActiveSupport",[482,2796,702],{"style":495},[482,2798,2799],{"style":517},"Concern",[482,2801],{"class":484,"style":485},[482,2803,2804,2807],{"class":484,"style":485},[482,2805,2806],{"style":495},"  included ",[482,2808,2809],{"style":527},"do",[482,2811,2812,2815],{"class":484,"style":485},[482,2813,2814],{"style":495},"    before_action ",[482,2816,2022],{"style":517},[482,2818,2819],{"class":484,"style":485},[482,2820,1061],{"style":527},[482,2822],{"class":484,"style":485},[482,2824,2825],{"class":484,"style":485},[482,2826,1800],{"style":527},[482,2828],{"class":484,"style":485},[482,2830,2831,2833],{"class":484,"style":485},[482,2832,869],{"style":527},[482,2834,2835],{"style":523}," underscore_params",[482,2837,2838,2841,2844,2847,2850,2852,2855],{"class":484,"style":485},[482,2839,2840],{"style":495},"    params.",[482,2842,2843],{"style":523},"deep_transform_keys!",[482,2845,2846],{"style":495}," { it.",[482,2848,2849],{"style":523},"to_s",[482,2851,285],{"style":495},[482,2853,2854],{"style":523},"underscore",[482,2856,1273],{"style":495},[482,2858,2859],{"class":484,"style":485},[482,2860,1061],{"style":527},[482,2862,2863],{"class":484,"style":485},[482,2864,644],{"style":527},[108,2866,2867,2868,2870,2871,443,2874,443,2877,2880],{},"This is great for most endpoints. But the ",[384,2869,456],{}," gem expects specific camelCase keys from the browser: ",[384,2872,2873],{},"rawId",[384,2875,2876],{},"clientDataJSON",[384,2878,2879],{},"attestationObject",". If we transform these to snake_case, the gem can't parse them.",[108,2882,2883],{},"The fix is simple. Skip the transformation for WebAuthn endpoints:",[474,2885,2886],{"language":476,"class":477},[384,2887,2888,490,2892,490,2902,490,2914,490,2919],{"class":480},[482,2889,2890],{"class":484,"style":485},[482,2891,2003],{"style":488},[482,2893,2894,2896,2898,2900],{"class":484,"style":485},[482,2895,846],{"style":527},[482,2897,2010],{"style":745},[482,2899,852],{"style":495},[482,2901,1614],{"style":517},[482,2903,2904,2906,2908,2910,2912],{"class":484,"style":485},[482,2905,2019],{"style":495},[482,2907,2022],{"style":517},[482,2909,443],{"style":495},[482,2911,1538],{"style":517},[482,2913,1541],{"style":517},[482,2915,2916],{"class":484,"style":485},[482,2917,2918],{"style":488},"  # ...",[482,2920,2921],{"class":484,"style":485},[482,2922,644],{"style":527},[290,2924,86],{"id":85},[108,2926,2927],{},"Now for the Vue component. We'll build it up piece by piece.",[108,2929,2930,2933,2934,2937,2938,2940,2941,2944],{},[139,2931,2932],{},"Note",": This modal uses Inertia's ",[384,2935,2936],{},"form.post()"," which expects server redirects. In ",[156,2939,1993],{"href":169},", we'll refactor this to use ",[384,2942,2943],{},"fetch()"," with JSON responses so we can display backup codes when users register their first passkey. The structure stays similar, but the submission logic changes.",[108,2946,2947],{},"First, the basic structure:",[474,2949,2951],{"language":2950,"class":477},"vue",[384,2952,2954,490,2977,490,2991,490,3003,490,3015,490,3027,490,3039,490,3041,490,3073,490,3075,490,3090,490,3112,490,3120,490,3125,490,3127,490,3132,490,3158,490,3163,490,3181],{"class":2953},"language-vue",[482,2955,2956,2959,2963,2966,2969,2971,2974],{"class":484,"style":485},[482,2957,2958],{"style":495},"\u003C",[482,2960,2962],{"style":2961},"color:#116329;--shiki-dark:#7EE787","script",[482,2964,2965],{"style":517}," setup",[482,2967,2968],{"style":517}," lang",[482,2970,1770],{"style":495},[482,2972,2973],{"style":499},"\"ts\"",[482,2975,2976],{"style":495},">",[482,2978,2979,2982,2985,2988],{"class":484,"style":485},[482,2980,2981],{"style":527},"import",[482,2983,2984],{"style":495}," { useForm } ",[482,2986,2987],{"style":527},"from",[482,2989,2990],{"style":499}," '@inertiajs\u002Fvue3'",[482,2992,2993,2995,2998,3000],{"class":484,"style":485},[482,2994,2981],{"style":527},[482,2996,2997],{"style":495}," { startRegistration } ",[482,2999,2987],{"style":527},[482,3001,3002],{"style":499}," '@simplewebauthn\u002Fbrowser'",[482,3004,3005,3007,3010,3012],{"class":484,"style":485},[482,3006,2981],{"style":527},[482,3008,3009],{"style":495}," { ref, watch } ",[482,3011,2987],{"style":527},[482,3013,3014],{"style":499}," 'vue'",[482,3016,3017,3019,3022,3024],{"class":484,"style":485},[482,3018,2981],{"style":527},[482,3020,3021],{"style":495}," { web_authn_credentials_options_path, web_authn_credentials_path } ",[482,3023,2987],{"style":527},[482,3025,3026],{"style":499}," '~\u002Froutes.js'",[482,3028,3029,3031,3034,3036],{"class":484,"style":485},[482,3030,2981],{"style":527},[482,3032,3033],{"style":495}," { getCsrfToken } ",[482,3035,2987],{"style":527},[482,3037,3038],{"style":499}," '~\u002Futils\u002Fcsrf'",[482,3040],{"class":484,"style":485},[482,3042,3043,3046,3049,3051,3054,3056,3059,3062,3065,3068,3070],{"class":484,"style":485},[482,3044,3045],{"style":527},"const",[482,3047,3048],{"style":517}," open",[482,3050,542],{"style":527},[482,3052,3053],{"style":523}," defineModel",[482,3055,2958],{"style":495},[482,3057,3058],{"style":517},"boolean",[482,3060,3061],{"style":495},">(",[482,3063,3064],{"style":499},"'open'",[482,3066,3067],{"style":495},", { required: ",[482,3069,2474],{"style":517},[482,3071,3072],{"style":495}," })",[482,3074],{"class":484,"style":485},[482,3076,3077,3079,3082,3084,3087],{"class":484,"style":485},[482,3078,3045],{"style":527},[482,3080,3081],{"style":517}," form",[482,3083,542],{"style":527},[482,3085,3086],{"style":523}," useForm",[482,3088,3089],{"style":495},"({",[482,3091,3092,3095,3098,3101,3104,3107,3110],{"class":484,"style":485},[482,3093,3094],{"style":495},"  credential: ",[482,3096,3097],{"style":517},"null",[482,3099,3100],{"style":527}," as",[482,3102,3103],{"style":517}," object",[482,3105,3106],{"style":527}," |",[482,3108,3109],{"style":517}," null",[482,3111,1289],{"style":495},[482,3113,3114,3117],{"class":484,"style":485},[482,3115,3116],{"style":495},"  nickname: ",[482,3118,3119],{"style":499},"''",[482,3121,3122],{"class":484,"style":485},[482,3123,3124],{"style":495},"})",[482,3126],{"class":484,"style":485},[482,3128,3129],{"class":484,"style":485},[482,3130,3131],{"style":488},"\u002F\u002F Client-side errors from browser WebAuthn API (NotAllowedError, etc.)",[482,3133,3134,3136,3139,3141,3144,3146,3148,3150,3152,3154,3156],{"class":484,"style":485},[482,3135,3045],{"style":527},[482,3137,3138],{"style":517}," clientError",[482,3140,542],{"style":527},[482,3142,3143],{"style":523}," ref",[482,3145,2958],{"style":495},[482,3147,934],{"style":517},[482,3149,3106],{"style":527},[482,3151,3109],{"style":517},[482,3153,3061],{"style":495},[482,3155,3097],{"style":517},[482,3157,564],{"style":495},[482,3159,3160],{"class":484,"style":485},[482,3161,3162],{"style":488},"\u002F\u002F Track the WebAuthn flow (fetch + browser ceremony), separate from form.processing",[482,3164,3165,3167,3170,3172,3174,3176,3179],{"class":484,"style":485},[482,3166,3045],{"style":527},[482,3168,3169],{"style":517}," isRegistering",[482,3171,542],{"style":527},[482,3173,3143],{"style":523},[482,3175,553],{"style":495},[482,3177,3178],{"style":517},"false",[482,3180,564],{"style":495},[482,3182,3183,3186,3188],{"class":484,"style":485},[482,3184,3185],{"style":495},"\u003C\u002F",[482,3187,2962],{"style":2961},[482,3189,2976],{"style":495},[108,3191,3192,3193,3196,3197,3200],{},"We use ",[384,3194,3195],{},"defineModel"," for two-way binding with the parent component. The ",[384,3198,3199],{},"useForm"," from Inertia manages both the credential data and the nickname field. Inertia's form helper automatically handles validation errors from the server - we'll see this in action when we build the template.",[108,3202,3203,3204,3207,3208,3211,3212,3214,3215,3218],{},"We have two separate refs for different purposes: ",[384,3205,3206],{},"clientError"," stores browser-side WebAuthn errors (like when a user cancels the prompt), and ",[384,3209,3210],{},"isRegistering"," tracks the WebAuthn flow. We need ",[384,3213,3210],{}," because ",[384,3216,3217],{},"form.processing"," only tracks Inertia requests, not our manual fetch calls or the browser's WebAuthn ceremony.",[108,3220,3221],{},"Next, we start the WebAuthn flow when the modal opens:",[474,3223,3224],{"language":2950,"class":477},[384,3225,3226,490,3242,490,3247,490,3249,490,3272,490,3289,490,3300,490,3319,490,3324,490,3334,490,3343,490,3352,490,3356,490,3360],{"class":2953},[482,3227,3228,3230,3232,3234,3236,3238,3240],{"class":484,"style":485},[482,3229,2958],{"style":495},[482,3231,2962],{"style":2961},[482,3233,2965],{"style":517},[482,3235,2968],{"style":517},[482,3237,1770],{"style":495},[482,3239,2973],{"style":499},[482,3241,2976],{"style":495},[482,3243,3244],{"class":484,"style":485},[482,3245,3246],{"style":488},"\u002F\u002F ... previous code",[482,3248],{"class":484,"style":485},[482,3250,3251,3254,3257,3260,3262,3265,3267,3270],{"class":484,"style":485},[482,3252,3253],{"style":523},"watch",[482,3255,3256],{"style":495},"(open, ",[482,3258,3259],{"style":527},"async",[482,3261,1323],{"style":495},[482,3263,3264],{"style":745},"isOpen",[482,3266,1334],{"style":495},[482,3268,3269],{"style":527},"=>",[482,3271,1297],{"style":495},[482,3273,3274,3277,3280,3283,3286],{"class":484,"style":485},[482,3275,3276],{"style":527},"  if",[482,3278,3279],{"style":495}," (isOpen ",[482,3281,3282],{"style":527},"&&",[482,3284,3285],{"style":527}," !",[482,3287,3288],{"style":495},"form.credential) {",[482,3290,3291,3294,3297],{"class":484,"style":485},[482,3292,3293],{"style":527},"    await",[482,3295,3296],{"style":523}," startWebAuthnFlow",[482,3298,3299],{"style":495},"()",[482,3301,3302,3305,3308,3311,3313,3316],{"class":484,"style":485},[482,3303,3304],{"style":495},"  } ",[482,3306,3307],{"style":527},"else",[482,3309,3310],{"style":527}," if",[482,3312,1323],{"style":495},[482,3314,3315],{"style":527},"!",[482,3317,3318],{"style":495},"isOpen) {",[482,3320,3321],{"class":484,"style":485},[482,3322,3323],{"style":488},"    \u002F\u002F Reset state when modal closes",[482,3325,3326,3329,3332],{"class":484,"style":485},[482,3327,3328],{"style":495},"    form.",[482,3330,3331],{"style":523},"reset",[482,3333,3299],{"style":495},[482,3335,3336,3339,3341],{"class":484,"style":485},[482,3337,3338],{"style":495},"    clientError.value ",[482,3340,1770],{"style":527},[482,3342,3109],{"style":517},[482,3344,3345,3348,3350],{"class":484,"style":485},[482,3346,3347],{"style":495},"    isRegistering.value ",[482,3349,1770],{"style":527},[482,3351,912],{"style":517},[482,3353,3354],{"class":484,"style":485},[482,3355,2495],{"style":495},[482,3357,3358],{"class":484,"style":485},[482,3359,3124],{"style":495},[482,3361,3362,3364,3366],{"class":484,"style":485},[482,3363,3185],{"style":495},[482,3365,2962],{"style":2961},[482,3367,2976],{"style":495},[108,3369,3370],{},"Why start immediately? Because the browser's WebAuthn prompt appears outside your control. Making users click \"Add passkey\" then click another button feels sluggish. Starting the ceremony as soon as the modal opens is more responsive.",[108,3372,3373],{},"The WebAuthn flow itself:",[474,3375,3376],{"language":2950,"class":477},[384,3377,3378,490,3394,490,3398,490,3400,490,3412,490,3422,490,3431,490,3440,490,3442,490,3449,490,3454,490,3478,490,3488,490,3493,490,3505,490,3517,490,3521,490,3526,490,3528,490,3539,490,3557,490,3561,490,3563,490,3582,490,3584,490,3589,490,3606,490,3608,490,3613,490,3622,490,3632,490,3640,490,3649,490,3657,490,3661,490,3665],{"class":2953},[482,3379,3380,3382,3384,3386,3388,3390,3392],{"class":484,"style":485},[482,3381,2958],{"style":495},[482,3383,2962],{"style":2961},[482,3385,2965],{"style":517},[482,3387,2968],{"style":517},[482,3389,1770],{"style":495},[482,3391,2973],{"style":499},[482,3393,2976],{"style":495},[482,3395,3396],{"class":484,"style":485},[482,3397,3246],{"style":488},[482,3399],{"class":484,"style":485},[482,3401,3402,3404,3407,3409],{"class":484,"style":485},[482,3403,3259],{"style":527},[482,3405,3406],{"style":527}," function",[482,3408,3296],{"style":523},[482,3410,3411],{"style":495},"() {",[482,3413,3414,3417,3420],{"class":484,"style":485},[482,3415,3416],{"style":495},"  form.",[482,3418,3419],{"style":523},"clearErrors",[482,3421,3299],{"style":495},[482,3423,3424,3427,3429],{"class":484,"style":485},[482,3425,3426],{"style":495},"  clientError.value ",[482,3428,1770],{"style":527},[482,3430,3109],{"style":517},[482,3432,3433,3436,3438],{"class":484,"style":485},[482,3434,3435],{"style":495},"  isRegistering.value ",[482,3437,1770],{"style":527},[482,3439,920],{"style":517},[482,3441],{"class":484,"style":485},[482,3443,3444,3447],{"class":484,"style":485},[482,3445,3446],{"style":527},"  try",[482,3448,1297],{"style":495},[482,3450,3451],{"class":484,"style":485},[482,3452,3453],{"style":488},"    \u002F\u002F Step 1: Get registration options from server",[482,3455,3456,3459,3462,3464,3467,3470,3472,3475],{"class":484,"style":485},[482,3457,3458],{"style":527},"    const",[482,3460,3461],{"style":517}," optionsResponse",[482,3463,542],{"style":527},[482,3465,3466],{"style":527}," await",[482,3468,3469],{"style":523}," fetch",[482,3471,553],{"style":495},[482,3473,3474],{"style":523},"web_authn_credentials_options_path",[482,3476,3477],{"style":495},"(), {",[482,3479,3480,3483,3486],{"class":484,"style":485},[482,3481,3482],{"style":495},"      method: ",[482,3484,3485],{"style":499},"'POST'",[482,3487,1289],{"style":495},[482,3489,3490],{"class":484,"style":485},[482,3491,3492],{"style":495},"      headers: {",[482,3494,3495,3498,3500,3503],{"class":484,"style":485},[482,3496,3497],{"style":499},"        'Content-Type'",[482,3499,453],{"style":495},[482,3501,3502],{"style":499},"'application\u002Fjson'",[482,3504,1289],{"style":495},[482,3506,3507,3510,3512,3515],{"class":484,"style":485},[482,3508,3509],{"style":499},"        'X-CSRF-Token'",[482,3511,453],{"style":495},[482,3513,3514],{"style":523},"getCsrfToken",[482,3516,3299],{"style":495},[482,3518,3519],{"class":484,"style":485},[482,3520,1746],{"style":495},[482,3522,3523],{"class":484,"style":485},[482,3524,3525],{"style":495},"    })",[482,3527],{"class":484,"style":485},[482,3529,3530,3532,3534,3536],{"class":484,"style":485},[482,3531,2079],{"style":527},[482,3533,1323],{"style":495},[482,3535,3315],{"style":527},[482,3537,3538],{"style":495},"optionsResponse.ok) {",[482,3540,3541,3544,3547,3550,3552,3555],{"class":484,"style":485},[482,3542,3543],{"style":527},"      throw",[482,3545,3546],{"style":527}," new",[482,3548,3549],{"style":523}," Error",[482,3551,553],{"style":495},[482,3553,3554],{"style":499},"'Failed to get registration options'",[482,3556,564],{"style":495},[482,3558,3559],{"class":484,"style":485},[482,3560,2751],{"style":495},[482,3562],{"class":484,"style":485},[482,3564,3565,3567,3570,3572,3574,3577,3580],{"class":484,"style":485},[482,3566,3458],{"style":527},[482,3568,3569],{"style":517}," optionsJSON",[482,3571,542],{"style":527},[482,3573,3466],{"style":527},[482,3575,3576],{"style":495}," optionsResponse.",[482,3578,3579],{"style":523},"json",[482,3581,3299],{"style":495},[482,3583],{"class":484,"style":485},[482,3585,3586],{"class":484,"style":485},[482,3587,3588],{"style":488},"    \u002F\u002F Step 2: Start browser WebAuthn registration",[482,3590,3591,3593,3596,3598,3600,3603],{"class":484,"style":485},[482,3592,3458],{"style":527},[482,3594,3595],{"style":517}," registrationResponse",[482,3597,542],{"style":527},[482,3599,3466],{"style":527},[482,3601,3602],{"style":523}," startRegistration",[482,3604,3605],{"style":495},"({ optionsJSON })",[482,3607],{"class":484,"style":485},[482,3609,3610],{"class":484,"style":485},[482,3611,3612],{"style":488},"    \u002F\u002F Step 3: Store credential and show nickname input",[482,3614,3615,3618,3620],{"class":484,"style":485},[482,3616,3617],{"style":495},"    form.credential ",[482,3619,1770],{"style":527},[482,3621,3595],{"style":495},[482,3623,3624,3626,3629],{"class":484,"style":485},[482,3625,3304],{"style":495},[482,3627,3628],{"style":527},"catch",[482,3630,3631],{"style":495}," (err) {",[482,3633,3634,3637],{"class":484,"style":485},[482,3635,3636],{"style":523},"    handleBrowserError",[482,3638,3639],{"style":495},"(err)",[482,3641,3642,3644,3647],{"class":484,"style":485},[482,3643,3304],{"style":495},[482,3645,3646],{"style":527},"finally",[482,3648,1297],{"style":495},[482,3650,3651,3653,3655],{"class":484,"style":485},[482,3652,3347],{"style":495},[482,3654,1770],{"style":527},[482,3656,912],{"style":517},[482,3658,3659],{"class":484,"style":485},[482,3660,2495],{"style":495},[482,3662,3663],{"class":484,"style":485},[482,3664,2285],{"style":495},[482,3666,3667,3669,3671],{"class":484,"style":485},[482,3668,3185],{"style":495},[482,3670,2962],{"style":2961},[482,3672,2976],{"style":495},[108,3674,3675,3676,3679,3680,3682,3683,3685],{},"Three steps: get options from the server, trigger the browser ceremony, store the result in ",[384,3677,3678],{},"form.credential",". We set ",[384,3681,3210],{}," to true at the start and use ",[384,3684,3646],{}," to set it back to false regardless of success or failure. If anything fails, we show an error and let the user retry.",[108,3687,3688],{},"The error handler translates browser-side WebAuthn errors into human-readable messages:",[474,3690,3691],{"language":2950,"class":477},[384,3692,3693,490,3709,490,3713,490,3715,490,3736,490,3750,490,3765,490,3775,490,3793,490,3802,490,3810,490,3819,490,3823,490,3831,490,3840,490,3844,490,3848],{"class":2953},[482,3694,3695,3697,3699,3701,3703,3705,3707],{"class":484,"style":485},[482,3696,2958],{"style":495},[482,3698,2962],{"style":2961},[482,3700,2965],{"style":517},[482,3702,2968],{"style":517},[482,3704,1770],{"style":495},[482,3706,2973],{"style":499},[482,3708,2976],{"style":495},[482,3710,3711],{"class":484,"style":485},[482,3712,3246],{"style":488},[482,3714],{"class":484,"style":485},[482,3716,3717,3720,3723,3725,3728,3730,3733],{"class":484,"style":485},[482,3718,3719],{"style":527},"function",[482,3721,3722],{"style":523}," handleBrowserError",[482,3724,553],{"style":495},[482,3726,3727],{"style":745},"err",[482,3729,472],{"style":527},[482,3731,3732],{"style":517}," unknown",[482,3734,3735],{"style":495},") {",[482,3737,3738,3740,3743,3746,3748],{"class":484,"style":485},[482,3739,3276],{"style":527},[482,3741,3742],{"style":495}," (err ",[482,3744,3745],{"style":527},"instanceof",[482,3747,3549],{"style":745},[482,3749,3735],{"style":495},[482,3751,3752,3754,3757,3760,3763],{"class":484,"style":485},[482,3753,2079],{"style":527},[482,3755,3756],{"style":495}," (err.name ",[482,3758,3759],{"style":527},"===",[482,3761,3762],{"style":499}," 'InvalidStateError'",[482,3764,3735],{"style":495},[482,3766,3767,3770,3772],{"class":484,"style":485},[482,3768,3769],{"style":495},"      clientError.value ",[482,3771,1770],{"style":527},[482,3773,3774],{"style":499}," 'This authenticator is already registered.'",[482,3776,3777,3780,3782,3784,3786,3788,3791],{"class":484,"style":485},[482,3778,3779],{"style":495},"    } ",[482,3781,3307],{"style":527},[482,3783,3310],{"style":527},[482,3785,3756],{"style":495},[482,3787,3759],{"style":527},[482,3789,3790],{"style":499}," 'NotAllowedError'",[482,3792,3735],{"style":495},[482,3794,3795,3797,3799],{"class":484,"style":485},[482,3796,3769],{"style":495},[482,3798,1770],{"style":527},[482,3800,3801],{"style":499}," 'Registration was cancelled or timed out.'",[482,3803,3804,3806,3808],{"class":484,"style":485},[482,3805,3779],{"style":495},[482,3807,3307],{"style":527},[482,3809,1297],{"style":495},[482,3811,3812,3814,3816],{"class":484,"style":485},[482,3813,3769],{"style":495},[482,3815,1770],{"style":527},[482,3817,3818],{"style":495}," err.message",[482,3820,3821],{"class":484,"style":485},[482,3822,2751],{"style":495},[482,3824,3825,3827,3829],{"class":484,"style":485},[482,3826,3304],{"style":495},[482,3828,3307],{"style":527},[482,3830,1297],{"style":495},[482,3832,3833,3835,3837],{"class":484,"style":485},[482,3834,3338],{"style":495},[482,3836,1770],{"style":527},[482,3838,3839],{"style":499}," 'An unexpected error occurred.'",[482,3841,3842],{"class":484,"style":485},[482,3843,2495],{"style":495},[482,3845,3846],{"class":484,"style":485},[482,3847,2285],{"style":495},[482,3849,3850,3852,3854],{"class":484,"style":485},[482,3851,3185],{"style":495},[482,3853,2962],{"style":2961},[482,3855,2976],{"style":495},[108,3857,3858,3861,3862,3865,3866,3868],{},[384,3859,3860],{},"NotAllowedError"," is the most common. It happens when users cancel the browser prompt or take too long. ",[384,3863,3864],{},"InvalidStateError"," happens when trying to register an authenticator that's already registered (though our ",[384,3867,1906],{}," parameter should prevent this).",[108,3870,3871],{},"Finally, submitting the nickname. This function gets called when the user clicks the Save button:",[474,3873,3874],{"language":2950,"class":477},[384,3875,3876,490,3892,490,3896,490,3898,490,3907,490,3921,490,3923,490,3937,490,3942,490,3947,490,3951,490,3953,490,3962,490,3971,490,3975],{"class":2953},[482,3877,3878,3880,3882,3884,3886,3888,3890],{"class":484,"style":485},[482,3879,2958],{"style":495},[482,3881,2962],{"style":2961},[482,3883,2965],{"style":517},[482,3885,2968],{"style":517},[482,3887,1770],{"style":495},[482,3889,2973],{"style":499},[482,3891,2976],{"style":495},[482,3893,3894],{"class":484,"style":485},[482,3895,3246],{"style":488},[482,3897],{"class":484,"style":485},[482,3899,3900,3902,3905],{"class":484,"style":485},[482,3901,3719],{"style":527},[482,3903,3904],{"style":523}," submitNickname",[482,3906,3411],{"style":495},[482,3908,3909,3911,3913,3915,3918],{"class":484,"style":485},[482,3910,3276],{"style":527},[482,3912,1323],{"style":495},[482,3914,3315],{"style":527},[482,3916,3917],{"style":495},"form.credential) ",[482,3919,3920],{"style":527},"return",[482,3922],{"class":484,"style":485},[482,3924,3925,3927,3930,3932,3935],{"class":484,"style":485},[482,3926,3416],{"style":495},[482,3928,3929],{"style":523},"post",[482,3931,553],{"style":495},[482,3933,3934],{"style":523},"web_authn_credentials_path",[482,3936,3477],{"style":495},[482,3938,3939],{"class":484,"style":485},[482,3940,3941],{"style":495},"    onSuccess: handleClose",[482,3943,3944],{"class":484,"style":485},[482,3945,3946],{"style":495},"  })",[482,3948,3949],{"class":484,"style":485},[482,3950,2285],{"style":495},[482,3952],{"class":484,"style":485},[482,3954,3955,3957,3960],{"class":484,"style":485},[482,3956,3719],{"style":527},[482,3958,3959],{"style":523}," handleClose",[482,3961,3411],{"style":495},[482,3963,3964,3967,3969],{"class":484,"style":485},[482,3965,3966],{"style":495},"  open.value ",[482,3968,1770],{"style":527},[482,3970,912],{"style":517},[482,3972,3973],{"class":484,"style":485},[482,3974,2285],{"style":495},[482,3976,3977,3979,3981],{"class":484,"style":485},[482,3978,3185],{"style":495},[482,3980,2962],{"style":2961},[482,3982,2976],{"style":495},[108,3984,3985,3986,3989,3990,3992,3993,3996,3997,3999],{},"Notice there's no ",[384,3987,3988],{},"onError"," callback. That's because Inertia's ",[384,3991,3199],{}," handles errors automatically. When the server returns validation errors via ",[384,3994,3995],{},"inertia_errors()",", they populate ",[384,3998,2509],{}," which we can access in the template.",[108,4001,4002],{},"Here's the template that ties everything together:",[474,4004,4005],{"language":2950,"class":477},[384,4006,4007,490,4016,490,4070,490,4085,490,4090,490,4116,490,4142,490,4162,490,4171,490,4173,490,4178,490,4201,490,4247,490,4262,490,4306,490,4332,490,4341,490,4349,490,4351,490,4356,490,4377,490,4384,490,4394,490,4399,490,4416,490,4421,490,4428,490,4442,490,4452,490,4462,490,4478,490,4483,490,4491,490,4493,490,4507,490,4513,490,4522,490,4531,490,4545,490,4560,490,4565,490,4570,490,4579,490,4618,490,4626,490,4634,490,4643,490,4652],{"class":2953},[482,4008,4009,4011,4014],{"class":484,"style":485},[482,4010,2958],{"style":495},[482,4012,4013],{"style":2961},"template",[482,4015,2976],{"style":495},[482,4017,4018,4021,4024,4027,4029,4032,4034,4036,4038,4040,4043,4045,4048,4051,4054,4056,4058,4061,4064,4066,4068],{"class":484,"style":485},[482,4019,4020],{"style":495},"  \u003C",[482,4022,4023],{"style":2961},"UModal",[482,4025,4026],{"style":517}," v-model",[482,4028,472],{"style":495},[482,4030,4031],{"style":517},"open",[482,4033,1770],{"style":495},[482,4035,2288],{"style":495},[482,4037,4031],{"style":495},[482,4039,2288],{"style":495},[482,4041,4042],{"style":517}," title",[482,4044,1770],{"style":495},[482,4046,4047],{"style":499},"\"Add Passkey\"",[482,4049,4050],{"style":495}," :",[482,4052,4053],{"style":517},"ui",[482,4055,1770],{"style":495},[482,4057,2288],{"style":495},[482,4059,4060],{"style":495},"{ footer: ",[482,4062,4063],{"style":499},"'justify-end'",[482,4065,1273],{"style":495},[482,4067,2288],{"style":495},[482,4069,2976],{"style":495},[482,4071,4072,4075,4077,4080,4083],{"class":484,"style":485},[482,4073,4074],{"style":495},"    \u003C",[482,4076,4013],{"style":2961},[482,4078,4079],{"style":495}," #",[482,4081,4082],{"style":517},"body",[482,4084,2976],{"style":495},[482,4086,4087],{"class":484,"style":485},[482,4088,4089],{"style":488},"      \u003C!-- Loading state while browser WebAuthn is in progress -->",[482,4091,4092,4095,4098,4101,4103,4106,4109,4111,4114],{"class":484,"style":485},[482,4093,4094],{"style":495},"      \u003C",[482,4096,4097],{"style":2961},"div",[482,4099,4100],{"style":517}," v-if",[482,4102,1770],{"style":495},[482,4104,4105],{"style":499},"\"isRegistering && !form.credential\"",[482,4107,4108],{"style":517}," class",[482,4110,1770],{"style":495},[482,4112,4113],{"style":499},"\"flex flex-col items-center gap-4 py-8\"",[482,4115,2976],{"style":495},[482,4117,4118,4121,4124,4127,4129,4132,4134,4136,4139],{"class":484,"style":485},[482,4119,4120],{"style":495},"        \u003C",[482,4122,4123],{"style":2961},"UIcon",[482,4125,4126],{"style":517}," name",[482,4128,1770],{"style":495},[482,4130,4131],{"style":499},"\"i-hugeicons-loading-03\"",[482,4133,4108],{"style":517},[482,4135,1770],{"style":495},[482,4137,4138],{"style":499},"\"text-primary size-8 animate-spin\"",[482,4140,4141],{"style":495}," \u002F>",[482,4143,4144,4146,4148,4150,4152,4155,4158,4160],{"class":484,"style":485},[482,4145,4120],{"style":495},[482,4147,108],{"style":2961},[482,4149,4108],{"style":517},[482,4151,1770],{"style":495},[482,4153,4154],{"style":499},"\"text-muted\"",[482,4156,4157],{"style":495},">Follow your browser's prompts to register your passkey...\u003C\u002F",[482,4159,108],{"style":2961},[482,4161,2976],{"style":495},[482,4163,4164,4167,4169],{"class":484,"style":485},[482,4165,4166],{"style":495},"      \u003C\u002F",[482,4168,4097],{"style":2961},[482,4170,2976],{"style":495},[482,4172],{"class":484,"style":485},[482,4174,4175],{"class":484,"style":485},[482,4176,4177],{"style":488},"      \u003C!-- Error state if WebAuthn failed -->",[482,4179,4180,4182,4184,4187,4189,4192,4194,4196,4199],{"class":484,"style":485},[482,4181,4094],{"style":495},[482,4183,4097],{"style":2961},[482,4185,4186],{"style":517}," v-else-if",[482,4188,1770],{"style":495},[482,4190,4191],{"style":499},"\"clientError && !form.credential\"",[482,4193,4108],{"style":517},[482,4195,1770],{"style":495},[482,4197,4198],{"style":499},"\"flex flex-col gap-4\"",[482,4200,2976],{"style":495},[482,4202,4203,4205,4208,4211,4213,4216,4219,4221,4224,4226,4229,4231,4233,4235,4237,4240,4242,4245],{"class":484,"style":485},[482,4204,4120],{"style":495},[482,4206,4207],{"style":2961},"UAlert",[482,4209,4210],{"style":517}," color",[482,4212,1770],{"style":495},[482,4214,4215],{"style":499},"\"error\"",[482,4217,4218],{"style":517}," variant",[482,4220,1770],{"style":495},[482,4222,4223],{"style":499},"\"soft\"",[482,4225,4050],{"style":495},[482,4227,4228],{"style":517},"title",[482,4230,1770],{"style":495},[482,4232,2288],{"style":495},[482,4234,3206],{"style":495},[482,4236,2288],{"style":495},[482,4238,4239],{"style":517}," icon",[482,4241,1770],{"style":495},[482,4243,4244],{"style":499},"\"i-hugeicons-alert-circle\"",[482,4246,4141],{"style":495},[482,4248,4249,4251,4253,4255,4257,4260],{"class":484,"style":485},[482,4250,4120],{"style":495},[482,4252,4097],{"style":2961},[482,4254,4108],{"style":517},[482,4256,1770],{"style":495},[482,4258,4259],{"style":499},"\"flex justify-end gap-2\"",[482,4261,2976],{"style":495},[482,4263,4264,4267,4270,4272,4274,4277,4279,4281,4284,4287,4290,4292,4294,4297,4299,4302,4304],{"class":484,"style":485},[482,4265,4266],{"style":495},"          \u003C",[482,4268,4269],{"style":2961},"UButton",[482,4271,4210],{"style":517},[482,4273,1770],{"style":495},[482,4275,4276],{"style":499},"\"neutral\"",[482,4278,4218],{"style":517},[482,4280,1770],{"style":495},[482,4282,4283],{"style":499},"\"outline\"",[482,4285,4286],{"style":495}," @",[482,4288,4289],{"style":517},"click",[482,4291,1770],{"style":495},[482,4293,2288],{"style":495},[482,4295,4296],{"style":495},"handleClose",[482,4298,2288],{"style":495},[482,4300,4301],{"style":495},"> Cancel \u003C\u002F",[482,4303,4269],{"style":2961},[482,4305,2976],{"style":495},[482,4307,4308,4310,4312,4314,4316,4318,4320,4323,4325,4328,4330],{"class":484,"style":485},[482,4309,4266],{"style":495},[482,4311,4269],{"style":2961},[482,4313,4286],{"style":495},[482,4315,4289],{"style":517},[482,4317,1770],{"style":495},[482,4319,2288],{"style":495},[482,4321,4322],{"style":495},"startWebAuthnFlow",[482,4324,2288],{"style":495},[482,4326,4327],{"style":495},">Try again\u003C\u002F",[482,4329,4269],{"style":2961},[482,4331,2976],{"style":495},[482,4333,4334,4337,4339],{"class":484,"style":485},[482,4335,4336],{"style":495},"        \u003C\u002F",[482,4338,4097],{"style":2961},[482,4340,2976],{"style":495},[482,4342,4343,4345,4347],{"class":484,"style":485},[482,4344,4166],{"style":495},[482,4346,4097],{"style":2961},[482,4348,2976],{"style":495},[482,4350],{"class":484,"style":485},[482,4352,4353],{"class":484,"style":485},[482,4354,4355],{"style":488},"      \u003C!-- Nickname input after successful WebAuthn registration -->",[482,4357,4358,4360,4362,4364,4366,4369,4371,4373,4375],{"class":484,"style":485},[482,4359,4094],{"style":495},[482,4361,4097],{"style":2961},[482,4363,4186],{"style":517},[482,4365,1770],{"style":495},[482,4367,4368],{"style":499},"\"form.credential\"",[482,4370,4108],{"style":517},[482,4372,1770],{"style":495},[482,4374,4198],{"style":499},[482,4376,2976],{"style":495},[482,4378,4379,4381],{"class":484,"style":485},[482,4380,4120],{"style":495},[482,4382,4383],{"style":2961},"UFormField",[482,4385,4386,4389,4391],{"class":484,"style":485},[482,4387,4388],{"style":517},"          label",[482,4390,1770],{"style":495},[482,4392,4393],{"style":499},"\"Give your passkey a name to recognize it later.\"",[482,4395,4396],{"class":484,"style":485},[482,4397,4398],{"style":517},"          required",[482,4400,4401,4404,4407,4409,4411,4414],{"class":484,"style":485},[482,4402,4403],{"style":495},"          :",[482,4405,4406],{"style":517},"error",[482,4408,1770],{"style":495},[482,4410,2288],{"style":495},[482,4412,4413],{"style":495},"form.errors.nickname",[482,4415,2288],{"style":495},[482,4417,4418],{"class":484,"style":485},[482,4419,4420],{"style":495},"        >",[482,4422,4423,4425],{"class":484,"style":485},[482,4424,4266],{"style":495},[482,4426,4427],{"style":2961},"UInput",[482,4429,4430,4433,4435,4437,4440],{"class":484,"style":485},[482,4431,4432],{"style":517},"            v-model",[482,4434,1770],{"style":495},[482,4436,2288],{"style":495},[482,4438,4439],{"style":495},"form.nickname",[482,4441,2288],{"style":495},[482,4443,4444,4447,4449],{"class":484,"style":485},[482,4445,4446],{"style":517},"            placeholder",[482,4448,1770],{"style":495},[482,4450,4451],{"style":499},"\"Passkey\"",[482,4453,4454,4457,4459],{"class":484,"style":485},[482,4455,4456],{"style":517},"            class",[482,4458,1770],{"style":495},[482,4460,4461],{"style":499},"\"w-full\"",[482,4463,4464,4467,4470,4472,4474,4476],{"class":484,"style":485},[482,4465,4466],{"style":495},"            :",[482,4468,4469],{"style":517},"disabled",[482,4471,1770],{"style":495},[482,4473,2288],{"style":495},[482,4475,3217],{"style":495},[482,4477,2288],{"style":495},[482,4479,4480],{"class":484,"style":485},[482,4481,4482],{"style":495},"          \u002F>",[482,4484,4485,4487,4489],{"class":484,"style":485},[482,4486,4336],{"style":495},[482,4488,4383],{"style":2961},[482,4490,2976],{"style":495},[482,4492],{"class":484,"style":485},[482,4494,4495,4497,4499,4501,4503,4505],{"class":484,"style":485},[482,4496,4120],{"style":495},[482,4498,4097],{"style":2961},[482,4500,4108],{"style":517},[482,4502,1770],{"style":495},[482,4504,4259],{"style":499},[482,4506,2976],{"style":495},[482,4508,4509,4511],{"class":484,"style":485},[482,4510,4266],{"style":495},[482,4512,4269],{"style":2961},[482,4514,4515,4518,4520],{"class":484,"style":485},[482,4516,4517],{"style":517},"            color",[482,4519,1770],{"style":495},[482,4521,4276],{"style":499},[482,4523,4524,4527,4529],{"class":484,"style":485},[482,4525,4526],{"style":517},"            variant",[482,4528,1770],{"style":495},[482,4530,4283],{"style":499},[482,4532,4533,4535,4537,4539,4541,4543],{"class":484,"style":485},[482,4534,4466],{"style":495},[482,4536,4469],{"style":517},[482,4538,1770],{"style":495},[482,4540,2288],{"style":495},[482,4542,3217],{"style":495},[482,4544,2288],{"style":495},[482,4546,4547,4550,4552,4554,4556,4558],{"class":484,"style":485},[482,4548,4549],{"style":495},"            @",[482,4551,4289],{"style":517},[482,4553,1770],{"style":495},[482,4555,2288],{"style":495},[482,4557,4296],{"style":495},[482,4559,2288],{"style":495},[482,4561,4562],{"class":484,"style":485},[482,4563,4564],{"style":495},"          >",[482,4566,4567],{"class":484,"style":485},[482,4568,4569],{"style":495},"            Cancel",[482,4571,4572,4575,4577],{"class":484,"style":485},[482,4573,4574],{"style":495},"          \u003C\u002F",[482,4576,4269],{"style":2961},[482,4578,2976],{"style":495},[482,4580,4581,4583,4585,4587,4590,4592,4594,4596,4598,4600,4602,4604,4606,4609,4611,4614,4616],{"class":484,"style":485},[482,4582,4266],{"style":495},[482,4584,4269],{"style":2961},[482,4586,4050],{"style":495},[482,4588,4589],{"style":517},"loading",[482,4591,1770],{"style":495},[482,4593,2288],{"style":495},[482,4595,3217],{"style":495},[482,4597,2288],{"style":495},[482,4599,4286],{"style":495},[482,4601,4289],{"style":517},[482,4603,1770],{"style":495},[482,4605,2288],{"style":495},[482,4607,4608],{"style":495},"submitNickname",[482,4610,2288],{"style":495},[482,4612,4613],{"style":495},"> Save \u003C\u002F",[482,4615,4269],{"style":2961},[482,4617,2976],{"style":495},[482,4619,4620,4622,4624],{"class":484,"style":485},[482,4621,4336],{"style":495},[482,4623,4097],{"style":2961},[482,4625,2976],{"style":495},[482,4627,4628,4630,4632],{"class":484,"style":485},[482,4629,4166],{"style":495},[482,4631,4097],{"style":2961},[482,4633,2976],{"style":495},[482,4635,4636,4639,4641],{"class":484,"style":485},[482,4637,4638],{"style":495},"    \u003C\u002F",[482,4640,4013],{"style":2961},[482,4642,2976],{"style":495},[482,4644,4645,4648,4650],{"class":484,"style":485},[482,4646,4647],{"style":495},"  \u003C\u002F",[482,4649,4023],{"style":2961},[482,4651,2976],{"style":495},[482,4653,4654,4656,4658],{"class":484,"style":485},[482,4655,3185],{"style":495},[482,4657,4013],{"style":2961},[482,4659,2976],{"style":495},[108,4661,4662,4663,4666,4667,4669,4670,4672],{},"The template has three states: loading (while the browser WebAuthn prompt is shown), error (if WebAuthn failed), and the nickname form (after successful WebAuthn registration). The key line is ",[384,4664,4665],{},":error=\"form.errors.nickname\""," - this binds the server validation error directly to the form field. When the server returns ",[384,4668,2428],{},", Inertia automatically populates ",[384,4671,4413],{}," and the error displays inline.",[290,4674,89],{"id":88},[108,4676,4677,4678,4680],{},"The registration modal lives inside a ",[384,4679,2598],{}," component that displays the user's passkeys and handles deletion:",[474,4682,4683],{"language":2950,"class":477},[384,4684,4685,490,4701,490,4712,490,4723,490,4734,490,4746,490,4757,490,4759,490,4767,490,4804,490,4809,490,4811,490,4828,490,4845,490,4862,490,4904,490,4921,490,4923,490,4935,490,4947,490,4951,490,4953,490,4986,490,4996,490,5005,490,5009,490,5011,490,5020,490,5033,490,5035,490,5044,490,5059,490,5071,490,5080,490,5089,490,5098,490,5102,490,5106,490,5110],{"class":2953},[482,4686,4687,4689,4691,4693,4695,4697,4699],{"class":484,"style":485},[482,4688,2958],{"style":495},[482,4690,2962],{"style":2961},[482,4692,2965],{"style":517},[482,4694,2968],{"style":517},[482,4696,1770],{"style":495},[482,4698,2973],{"style":499},[482,4700,2976],{"style":495},[482,4702,4703,4705,4708,4710],{"class":484,"style":485},[482,4704,2981],{"style":527},[482,4706,4707],{"style":495}," { router } ",[482,4709,2987],{"style":527},[482,4711,2990],{"style":499},[482,4713,4714,4716,4719,4721],{"class":484,"style":485},[482,4715,2981],{"style":527},[482,4717,4718],{"style":495}," { browserSupportsWebAuthn } ",[482,4720,2987],{"style":527},[482,4722,3002],{"style":499},[482,4724,4725,4727,4730,4732],{"class":484,"style":485},[482,4726,2981],{"style":527},[482,4728,4729],{"style":495}," { onMounted, ref } ",[482,4731,2987],{"style":527},[482,4733,3014],{"style":499},[482,4735,4736,4738,4741,4743],{"class":484,"style":485},[482,4737,2981],{"style":527},[482,4739,4740],{"style":495}," WebAuthnRegisterModal ",[482,4742,2987],{"style":527},[482,4744,4745],{"style":499}," '~\u002Fcomponents\u002Fusers\u002FWebAuthnRegisterModal.vue'",[482,4747,4748,4750,4753,4755],{"class":484,"style":485},[482,4749,2981],{"style":527},[482,4751,4752],{"style":495}," { web_authn_credential_path } ",[482,4754,2987],{"style":527},[482,4756,3026],{"style":499},[482,4758],{"class":484,"style":485},[482,4760,4761,4764],{"class":484,"style":485},[482,4762,4763],{"style":523},"defineProps",[482,4765,4766],{"style":495},"\u003C{",[482,4768,4769,4772,4774,4776,4778,4780,4783,4786,4788,4790,4792,4794,4797,4799,4801],{"class":484,"style":485},[482,4770,4771],{"style":745},"  credentials",[482,4773,472],{"style":527},[482,4775,1264],{"style":495},[482,4777,2331],{"style":745},[482,4779,472],{"style":527},[482,4781,4782],{"style":517}," string",[482,4784,4785],{"style":495},"; ",[482,4787,1093],{"style":745},[482,4789,472],{"style":527},[482,4791,4782],{"style":517},[482,4793,4785],{"style":495},[482,4795,4796],{"style":745},"created_at",[482,4798,472],{"style":527},[482,4800,4782],{"style":517},[482,4802,4803],{"style":495}," }[]",[482,4805,4806],{"class":484,"style":485},[482,4807,4808],{"style":495},"}>()",[482,4810],{"class":484,"style":485},[482,4812,4813,4815,4818,4820,4822,4824,4826],{"class":484,"style":485},[482,4814,3045],{"style":527},[482,4816,4817],{"style":517}," isSupported",[482,4819,542],{"style":527},[482,4821,3143],{"style":523},[482,4823,553],{"style":495},[482,4825,2474],{"style":517},[482,4827,564],{"style":495},[482,4829,4830,4832,4835,4837,4839,4841,4843],{"class":484,"style":485},[482,4831,3045],{"style":527},[482,4833,4834],{"style":517}," showRegisterModal",[482,4836,542],{"style":527},[482,4838,3143],{"style":523},[482,4840,553],{"style":495},[482,4842,3178],{"style":517},[482,4844,564],{"style":495},[482,4846,4847,4849,4852,4854,4856,4858,4860],{"class":484,"style":485},[482,4848,3045],{"style":527},[482,4850,4851],{"style":517}," showDeleteModal",[482,4853,542],{"style":527},[482,4855,3143],{"style":523},[482,4857,553],{"style":495},[482,4859,3178],{"style":517},[482,4861,564],{"style":495},[482,4863,4864,4866,4869,4871,4873,4876,4878,4880,4882,4884,4886,4888,4890,4893,4896,4898,4900,4902],{"class":484,"style":485},[482,4865,3045],{"style":527},[482,4867,4868],{"style":517}," credentialToDelete",[482,4870,542],{"style":527},[482,4872,3143],{"style":523},[482,4874,4875],{"style":495},"\u003C{ ",[482,4877,2331],{"style":745},[482,4879,472],{"style":527},[482,4881,4782],{"style":517},[482,4883,4785],{"style":495},[482,4885,1093],{"style":745},[482,4887,472],{"style":527},[482,4889,4782],{"style":517},[482,4891,4892],{"style":495}," } ",[482,4894,4895],{"style":527},"|",[482,4897,3109],{"style":517},[482,4899,3061],{"style":495},[482,4901,3097],{"style":517},[482,4903,564],{"style":495},[482,4905,4906,4908,4911,4913,4915,4917,4919],{"class":484,"style":485},[482,4907,3045],{"style":527},[482,4909,4910],{"style":517}," isDeleting",[482,4912,542],{"style":527},[482,4914,3143],{"style":523},[482,4916,553],{"style":495},[482,4918,3178],{"style":517},[482,4920,564],{"style":495},[482,4922],{"class":484,"style":485},[482,4924,4925,4928,4931,4933],{"class":484,"style":485},[482,4926,4927],{"style":523},"onMounted",[482,4929,4930],{"style":495},"(() ",[482,4932,3269],{"style":527},[482,4934,1297],{"style":495},[482,4936,4937,4940,4942,4945],{"class":484,"style":485},[482,4938,4939],{"style":495},"  isSupported.value ",[482,4941,1770],{"style":527},[482,4943,4944],{"style":523}," browserSupportsWebAuthn",[482,4946,3299],{"style":495},[482,4948,4949],{"class":484,"style":485},[482,4950,3124],{"style":495},[482,4952],{"class":484,"style":485},[482,4954,4955,4957,4960,4962,4965,4967,4969,4971,4973,4975,4977,4979,4981,4983],{"class":484,"style":485},[482,4956,3719],{"style":527},[482,4958,4959],{"style":523}," confirmDelete",[482,4961,553],{"style":495},[482,4963,4964],{"style":745},"credential",[482,4966,472],{"style":527},[482,4968,1264],{"style":495},[482,4970,2331],{"style":745},[482,4972,472],{"style":527},[482,4974,4782],{"style":517},[482,4976,4785],{"style":495},[482,4978,1093],{"style":745},[482,4980,472],{"style":527},[482,4982,4782],{"style":517},[482,4984,4985],{"style":495}," }) {",[482,4987,4988,4991,4993],{"class":484,"style":485},[482,4989,4990],{"style":495},"  credentialToDelete.value ",[482,4992,1770],{"style":527},[482,4994,4995],{"style":495}," credential",[482,4997,4998,5001,5003],{"class":484,"style":485},[482,4999,5000],{"style":495},"  showDeleteModal.value ",[482,5002,1770],{"style":527},[482,5004,920],{"style":517},[482,5006,5007],{"class":484,"style":485},[482,5008,2285],{"style":495},[482,5010],{"class":484,"style":485},[482,5012,5013,5015,5018],{"class":484,"style":485},[482,5014,3719],{"style":527},[482,5016,5017],{"style":523}," deleteCredential",[482,5019,3411],{"style":495},[482,5021,5022,5024,5026,5028,5031],{"class":484,"style":485},[482,5023,3276],{"style":527},[482,5025,1323],{"style":495},[482,5027,3315],{"style":527},[482,5029,5030],{"style":495},"credentialToDelete.value) ",[482,5032,3920],{"style":527},[482,5034],{"class":484,"style":485},[482,5036,5037,5040,5042],{"class":484,"style":485},[482,5038,5039],{"style":495},"  isDeleting.value ",[482,5041,1770],{"style":527},[482,5043,920],{"style":517},[482,5045,5046,5049,5051,5053,5056],{"class":484,"style":485},[482,5047,5048],{"style":495},"  router.",[482,5050,2253],{"style":523},[482,5052,553],{"style":495},[482,5054,5055],{"style":523},"web_authn_credential_path",[482,5057,5058],{"style":495},"(credentialToDelete.value.id), {",[482,5060,5061,5064,5067,5069],{"class":484,"style":485},[482,5062,5063],{"style":523},"    onFinish",[482,5065,5066],{"style":495},": () ",[482,5068,3269],{"style":527},[482,5070,1297],{"style":495},[482,5072,5073,5076,5078],{"class":484,"style":485},[482,5074,5075],{"style":495},"      isDeleting.value ",[482,5077,1770],{"style":527},[482,5079,912],{"style":517},[482,5081,5082,5085,5087],{"class":484,"style":485},[482,5083,5084],{"style":495},"      showDeleteModal.value ",[482,5086,1770],{"style":527},[482,5088,912],{"style":517},[482,5090,5091,5094,5096],{"class":484,"style":485},[482,5092,5093],{"style":495},"      credentialToDelete.value ",[482,5095,1770],{"style":527},[482,5097,3109],{"style":517},[482,5099,5100],{"class":484,"style":485},[482,5101,2751],{"style":495},[482,5103,5104],{"class":484,"style":485},[482,5105,3946],{"style":495},[482,5107,5108],{"class":484,"style":485},[482,5109,2285],{"style":495},[482,5111,5112,5114,5116],{"class":484,"style":485},[482,5113,3185],{"style":495},[482,5115,2962],{"style":2961},[482,5117,2976],{"style":495},[108,5119,5120,5121,5124,5125,5128,5129,5132],{},"The component checks for WebAuthn support on mount and hides the \"Add passkey\" button if the browser doesn't support it. For deletion, we use ",[384,5122,5123],{},"router.delete()"," which triggers our ",[384,5126,5127],{},"CredentialsController#destroy"," action. The ",[384,5130,5131],{},"onFinish"," callback runs regardless of success or failure, cleaning up the modal state.",[108,5134,5135],{},"The template displays a table of existing passkeys with delete buttons, and includes both the register modal and a delete confirmation modal. We won't show the full template here since it's mostly UI code, but the key parts are:",[226,5137,5138,5141,5147],{},[229,5139,5140],{},"A table showing each passkey's nickname and creation date",[229,5142,5143,5144],{},"An \"Add passkey\" button that opens ",[384,5145,5146],{},"WebAuthnRegisterModal",[229,5148,5149,5150],{},"A delete confirmation modal that calls ",[384,5151,5152],{},"deleteCredential()",[290,5154,55],{"id":91},[108,5156,5157],{},"Registration issues you'll encounter:",[226,5159,5160,5169,5178],{},[229,5161,5162,5165,5166,5168],{},[139,5163,5164],{},"Challenge expired",": If the user takes too long to complete the biometric prompt (or walks away from their computer), the session challenge expires. The ",[384,5167,634],{}," in your config controls this. 120 seconds is usually enough, but consider showing a \"try again\" option if authentication fails.",[229,5170,5171,5174,5175,5177],{},[139,5172,5173],{},"Duplicate credential",": Users sometimes try to register the same passkey twice. The ",[384,5176,1075],{}," unique constraint catches this, but you'll want to show a friendly error message.",[229,5179,5180,5183,5184,5186],{},[139,5181,5182],{},"User cancelled",": Users can dismiss the browser's passkey prompt. Handle the ",[384,5185,3860],{}," from the frontend library and let them try again.",[220,5188,94],{"id":93},[474,5190,5191],{"language":476,"class":477},[384,5192,5193,490,5197,490,5205,490,5223,490,5227,490,5229,490,5237,490,5245,490,5257,490,5261,490,5263,490,5275],{"class":480},[482,5194,5195],{"class":484,"style":485},[482,5196,1505],{"style":488},[482,5198,5199,5201,5203],{"class":484,"style":485},[482,5200,1510],{"style":495},[482,5202,1141],{"style":517},[482,5204,528],{"style":527},[482,5206,5207,5209,5211,5213,5215,5217,5219,5221],{"class":484,"style":485},[482,5208,2629],{"style":495},[482,5210,2632],{"style":517},[482,5212,443],{"style":495},[482,5214,1538],{"style":517},[482,5216,2639],{"style":517},[482,5218,443],{"style":495},[482,5220,2644],{"style":517},[482,5222,2647],{"style":499},[482,5224,5225],{"class":484,"style":485},[482,5226,644],{"style":527},[482,5228],{"class":484,"style":485},[482,5230,5231,5233,5235],{"class":484,"style":485},[482,5232,1510],{"style":495},[482,5234,1513],{"style":517},[482,5236,528],{"style":527},[482,5238,5239,5241,5243],{"class":484,"style":485},[482,5240,1520],{"style":495},[482,5242,1523],{"style":517},[482,5244,528],{"style":527},[482,5246,5247,5249,5251,5253,5255],{"class":484,"style":485},[482,5248,1530],{"style":495},[482,5250,1533],{"style":517},[482,5252,443],{"style":495},[482,5254,1538],{"style":517},[482,5256,1541],{"style":517},[482,5258,5259],{"class":484,"style":485},[482,5260,1061],{"style":527},[482,5262],{"class":484,"style":485},[482,5264,5265,5267,5269,5271,5273],{"class":484,"style":485},[482,5266,1552],{"style":495},[482,5268,1523],{"style":517},[482,5270,443],{"style":495},[482,5272,1538],{"style":517},[482,5274,1561],{"style":517},[482,5276,5277],{"class":484,"style":485},[482,5278,644],{"style":527},[108,5280,5281],{},"This gives you:",[226,5283,5284,5290,5294,5298],{},[229,5285,5286,5289],{},[384,5287,5288],{},"GET \u002Fusers\u002Fsecurity"," - Security settings page",[229,5291,5292,1576],{},[384,5293,1575],{},[229,5295,5296,1582],{},[384,5297,1581],{},[229,5299,5300,1588],{},[384,5301,1587],{},[220,5303,97],{"id":96},[108,5305,5306],{},"At this point, users can add passkeys to their accounts. The passkeys are stored securely, and users can manage them from their security settings page.",[108,5308,5309,5310,5312],{},"In ",[156,5311,1953],{"href":158},", we'll implement authentication - first as 2FA (password + passkey), then as password-less (passkey only). We'll also clean up the code once password-less is working.",[108,5314,5315,5318],{},[111,5316,5317],{},"Next:",[156,5319,5320],{"href":158},[111,5321,5322],{},"Part 2 - Authentication: From 2FA to Password-less",1795440225088]