SBN

Decoding Passkey Ceremony A Developer’s Deep Dive

<h1>Decoding Passkey Ceremony A Developer&#39;s Deep Dive</h1>
<h2>What is Passkey Ceremony</h2>
<p>Ever wondered what goes on behind the scenes when you ditch that password for a passkey? It&#39;s more than just a simple &quot;yes&quot; or &quot;no.&quot;</p>
<p>Here&#39;s the lowdown on the passkey ceremony:</p>
<ul>
<li>It&#39;s basically the process for securely registering and authenticating your passkey. Think of it like a handshake, but with cryptography involved.</li>
<li>WebAuthn and fido2 standards are what makes it all possible. they&#39;re the rulebooks for how this handshake should happen. <a href="https://www.ciscolive.com/c/dam/r/ciscolive/global-event/docs/2024/pdf/BRKSEC-2202.pdf">BRKSEC-2202</a> – this Cisco presentation mentions FIDO2 and WebAuthn as key passkey specs.</li>
<li>There&#39;s a few players involved. you got the client (like your browser), the server (the website you&#39;re logging into), and the authenticator (like your phone or security key).</li>
</ul>
<p>Next up, we&#39;ll dive deeper into defining exactly what this &quot;passkey ceremony&quot; actually entails.</p>
<h2>Passkey Registration Ceremony Demystified</h2>
<p>Okay, let&#39;s demystify this passkey registration thing, shall we? It sounds complicated, but once you break it down, it&#39;s not <em>that</em> bad.</p>
<p>So, what exactly happens when you register a passkey? Here&#39;s the gist:</p>
<ul>
<li>It all starts when the user kicks off the passkey registration within an app.</li>
<li>The app then generates these <strong>credential creation options</strong>, kinda like setting the rules for the passkey.</li>
<li>Next, is the client-side interaction with the <strong>WebAuthn api</strong>. This is where your browser gets involved.</li>
<li>The authenticator (think your phone or security key) then asks for user verification – maybe a fingerprint or pin.</li>
<li>And finally, the authenticator does its magic, generating a <strong>key pair</strong> and stores the private key super securely. The public key? That gets sent to the server to be linked with your account.</li>
</ul>
<pre><code class="language-mermaid">sequenceDiagram
participant User
participant Application
participant Client
participant Authenticator

User-&gt;&gt;Application: Initiates passkey registration
Application-&gt;&gt;Client: Generates credential creation options
Client-&gt;&gt;Authenticator: Calls WebAuthn API with options
Authenticator-&gt;&gt;User: Prompts user for verification (biometric, PIN)
Authenticator-&gt;&gt;Authenticator: Generates key pair, stores private key
Authenticator-&gt;&gt;Client: Sends public key

Application-&gt;&gt;Application: Stores public key against user account
</code></pre>
<p>Attestation is basically proof that the key is legit and the device is what is says it is. It&#39;s like a <strong>digital certificate of authenticity</strong>. There are different attestation formats, and they all have different security implications. For instance, some might give you more info about the device, while others are more privacy-focused.</p>
<p>Now, figuring out how to handle attestation can depend on where its being implimented. Is it a high-security environment, or something more casual? Just something to keep in mind.</p>
<p>Alright, next up, let&#39;s talk about the role of attestation in all of this.</p>
<h2>Passkey Authentication Ceremony Unveiled</h2>
<p>Okay, so you&#39;ve registered your passkey, now what? It&#39;s time to actually use the darn thing to log in!</p>
<p>Here&#39;s the breakdown of what happens during the authentication ceremony:</p>
<ul>
<li>It all starts with the user trying to log in using a passkey. Pretty obvious, right?</li>
<li>The server then sends this <strong>authentication challenge</strong> to the client. It&#39;s basically asking &quot;prove it&quot;.</li>
<li>The client interacts with the <strong>WebAuthn api</strong> to fetch the passkey. Your browser&#39;s doing the heavy lifting here.</li>
<li>Now, the authenticator swings into action, prompting you for verification – fingerprint, face id, pin, whatever you set up.</li>
<li>If you are verified, the authenticator signs the challenge using its private key. This is like a digital signature only <em>you</em> can make.</li>
<li>The signed challenge is sent back to the server, which verifies it using the stored public key. If everything checks out, you&#39;re in!</li>
</ul>
<pre><code class="language-mermaid">sequenceDiagram
participant User
participant Application
participant Client
participant Authenticator

User-&gt;&gt;Application: Attempts sign-in
Application-&gt;&gt;Client: Generates authentication challenge
Client-&gt;&gt;Authenticator: Calls WebAuthn API with challenge
Authenticator-&gt;&gt;User: Prompts user for verification (biometric, PIN)
Authenticator-&gt;&gt;Authenticator: Signs challenge with private key
Authenticator-&gt;&gt;Client: Sends signed challenge

Application-&gt;&gt;Application: Verifies signature with public key
Application-&gt;&gt;User: Grants access
</code></pre>
<p>Conditional UI, or &quot;passkey autofill&quot; as <a href="https://medium.com/@corbado_tech/ultimate-passkeys-cheat-sheet-6b171557cbe0">the ultimate Passkeys Cheat Sheet</a> calls it, makes things way smoother. Instead of having to remember your username, it shows you all your available passkeys and lets you pick one.</p>
<p>Designing user-friendly flows is key to ensure that people actually <em>want</em> to use passkeys.</p>
<p>Next up, we&#39;ll dive into what conditional ui is all about and how it improves the user experience.</p>
<h2>Security and Privacy Considerations</h2>
<p>Passkeys sound great, right? But, like, what about security? It&#39;s gotta be solid.</p>
<p>Here&#39;s a few things to keep in mind:</p>
<ul>
<li>They are <strong>phishing resistant</strong>, which is great &#39;cause the browser checks the rpid (relying party id) to make sure it&#39;s legit, as BRKSEC-2202 notes.</li>
<li>The private key lives on <em>your</em> device, in what they call a &quot;secure enclave&quot;.</li>
<li>They&#39;re also good at stopping credential stuffing attacks, since each passkey is unique to each site.</li>
</ul>
<p>so, what&#39;s next? let&#39;s talk about privacy.</p>
<h2>Implementing Passkey Ceremony Best Practices</h2>
<p>Alright, so you&#39;re ready to roll out passkeys? Awesome, but hold on a sec – there&#39;s a few best practices to keep in mind so you don&#39;t accidentally mess things up.</p>
<ul>
<li><p><strong>Securely managing public keys on the server</strong> is super important. You gotta make sure these keys are stored safely, like in a properly secured database. Think about using encryption, access controls, and- regular backups to protect &#39;em.</p>
</li>
<li><p><strong>Handling different authenticator types and capabilities</strong> can be tricky to. Not all authenticators are created equal, some might support biometrics, others might not. Your code needs to be flexible enough to handle these differences gracefully and provide a good user experience no matter what authenticator they&#39;re using.</p>
</li>
<li><p><strong>Testing and validation strategies for passkey implementation</strong> are a must. Run thorough tests to make sure the passkey registration and authentication ceremonies are working correctly. This includes testing with different browsers, devices, and authenticators. As mentioned earlier, conditional ui can improve the user experience.</p>
</li>
</ul>
<p>Basically, it&#39;s all about keepin&#39; those keys safe, being flexible with different authenticators, and testing <em>everything</em>. Nail these, and you&#39;ll be well on your way to a smooth passkey implementation.</p>

*** This is a Security Bloggers Network syndicated blog from MojoAuth - Advanced Authentication &amp; Identity Solutions authored by MojoAuth - Advanced Authentication & Identity Solutions. Read the original post at: https://mojoauth.com/blog/decoding-passkey-ceremony-developers-deep-dive