Passkeys Are the New Norm. We Built the Package to Prove It.

#passkey#webauthn#auth+4 more

Illustration — Passkeys Are the New Norm. We Built the Package to Prove It.
INFO

Update, 30 September 2026. We stopped needing the package. Browsers now turn the server's JSON into a passkey request and hand back the public key in a form WebCrypto imports directly, so own-stack, the stack our new apps start from, runs passkeys with no auth library (try it). NextRole and Intel still run the package until their stored keys are converted.

There's a version of authentication that requires no password, no email link, no TOTP code, no "forgot password" flow, no credential breach risk, and no phishing surface.

It ships in every modern device and runs on biometrics: Face ID, Touch ID, Windows Hello. The protocol is a W3C standard, and support is near-universal.

And almost no apps use it.

That's a strange situation. The answer to "how do we fix authentication?" has been in production hardware for years. The problem is the implementation: wiring WebAuthn correctly, managing challenges server-side, handling the ceremony across registration and authentication, issuing session tokens. It's tedious enough that most teams just reach for next-auth and call it done.

We got tired of that. So we built @yannvr/auth.

What Passkeys Actually Are

A passkey is a public/private key pair where the private key never leaves your device.

When you register:

  1. Your device generates a key pair in the Secure Enclave (hardware-level isolation)
  2. The public key is sent to and stored by the server
  3. The private key stays locked in hardware, sealed by biometrics or device PIN

When you authenticate:

  1. The server sends a random challenge
  2. Your device signs it with the private key (gated behind Face ID / Touch ID / Windows Hello)
  3. The server verifies the signature with the stored public key

No password ever exists and no secret ever travels, so there is nothing to steal or phish.

The Web3 Connection

This matters doubly in crypto.

The biggest user experience failure in web3 is the seed phrase: twelve words that represent your entire financial life, written on paper, stored somewhere, sometimes lost and constantly phished.

When we wrote this in March 2026, Capital Engine had removed it entirely. The app used Porto, an EIP-7702 smart wallet connector that uses a device passkey as the authentication layer: no seed phrase, no browser extension, no gas confusion, just Face ID.

That is the WebAuthn standard applied to wallet signing. The key that signed DeFi transactions sat in the same Secure Enclave that protects your iPhone's payment data.

When we built that, we extracted the server-side auth logic into a reusable package, because if we needed it there, every app in the Hyperdrift ecosystem needed it.

The @yannvr/auth Package

The package covers the full WebAuthn ceremony for a Next.js App Router application.

Server Side

import { createWebAuthnConfig } from '@yannvr/auth/server'
import {
  handlePasskeyRegister, handlePasskeyVerifyRegistration,
  handlePasskeyAuthenticate, handlePasskeyVerifyAuthentication,
} from '@yannvr/auth/server'
import { setSessionCookie, clearSessionCookie, signToken, verifyToken } from '@yannvr/auth/server'
import { createAuthMiddleware, requireAuth, getServerUser } from '@yannvr/auth/server'

The four handlePasskey* functions are route handlers for the two ceremonies, each with an options step and a verify step. Each challenge travels in a signed, HttpOnly, SameSite=Strict cookie that expires after two minutes, so there is no server-side challenge store to run.

setSessionCookie and verifyToken cover the session: after a successful ceremony the server signs a JWT and sets it as an HttpOnly cookie, never readable by JavaScript. requireAuth and getServerUser read it back in route handlers and server components.

Client Side

import { usePasskeyLogin } from '@yannvr/auth/client'
import { AuthProvider, useAuth } from '@yannvr/auth/client'

usePasskeyLogin is a headless React hook that manages the full WebAuthn state machine. It handles startRegistration / startAuthentication from @simplewebauthn/browser, drives the server round-trips, and returns a clean { step, error, user, register, authenticate } interface.

const { step, error, register, authenticate, isSupported } = usePasskeyLogin()

// Register a new passkey
await register('user@example.com', 'Display Name')

// Authenticate with an existing passkey
await authenticate('user@example.com')

AuthProvider and useAuth are the React context layer. Wrap your app once; call useAuth() anywhere to get the current user or sign out.

The State Machine

idle → loading → success
              ↘ error → idle (via reset())

There are no manual loading flags and no try/catch in your component. The hook owns the ceremony; your UI observes the state.

Why Not next-auth?

next-auth (Auth.js) is excellent for OAuth flows like "Sign in with Google" or GitHub. If that's your model, use it.

But passkeys require you to own the ceremony. You're generating challenges, verifying signatures, managing the credential store. That ceremony doesn't map cleanly onto OAuth adapter abstractions.

@yannvr/auth is narrower by design: WebAuthn registration and authentication, session management via HttpOnly cookies, and nothing else. No OAuth, just the protocol, wired correctly.

Phishing Resistance by Design

This is the part that doesn't get enough emphasis.

Passkeys are origin-bound. The credential created for web3.hyperdrift.io can only be used on web3.hyperdrift.io. A phishing page at web3-hyperdrift.io (note the hyphen) will never receive a valid signature from the user's device: the browser checks the origin, the credential doesn't match, and the ceremony fails.

Passwords and TOTP codes don't have this property, and email magic links only partly do. Passkeys make the phishing vector structurally impossible.

For a DeFi app like Capital Engine, where a phishing attack means drained funds, that is the baseline.

The Path Forward

The ecosystem is moving. Apple, Google and Microsoft have all shipped passkey support in their platforms, the FIDO Alliance is pushing hard and browser support is excellent. The remaining gap is implementation: teams that know it's better but haven't done the migration.

@yannvr/auth is our bet that the Next.js ecosystem needs a simple, un-abstracted path to WebAuthn: the actual protocol rather than another OAuth adapter.

Passwords aren't going away immediately. To feel the difference, create a throwaway passkey on own-stack; to add passkeys to a Next.js app, install @yannvr/auth.

@yannvr/auth is published on npm under the MIT licence and built for the apps Hyperdrift runs. Questions, or just want to talk passkeys? Find us here.

Let’s talk

What could we build together?

Your note goes to the Hyperdrift team. We’ll use your email to reply about this enquiry.