Skip to main content

Module passkeys

Module passkeys 

Source
Expand description

Passkeys in the apps, each server through a relying party of its own under spoolframe.app: ServerId::rp_id.

A platform’s passkey API works only for a domain the app is associated with when it is built; a self-hosted server’s own domain is not known then. So the apps make and use their passkeys for <server id>.spoolframe.app, which one association file at spoolframe.app covers, with a wildcard. Sign-in runs between the app and the server over this protocol; the server never contacts spoolframe.app.

Because each server has its own relying party, a security key with passkeys for two servers offers only the right server’s at a sign-in. A passkey made for spoolframe.app itself (LEGACY_APP_RP_ID) signs in nowhere: its user adds it again.

Every server keeps its own passkeys, so a passkey made on one is refused by another. Each user has a random user handle per server, so one server’s says nothing about the same person on another.

The relying party comes from the server id the server names in ServerInfo, and a server may name another’s. So the challenge still names the server by its key: a server sends a random nonce, never a challenge, and the challenge is app_passkey_challenge of the server’s endpoint id and that nonce. The server computes it with its own id; the client with the id it pinned and dialled, never one the server names. A server that claims another’s server id and hands on its nonce, to relay a sign-in, has the app sign a challenge for itself, which the other refuses.

The bytes are WebAuthn’s own, as the platform API gives and takes them; the app maps them to and from it and changes nothing.

Structs§

FinishPasskeyRegistration
A passkey made for a PasskeyCreation, to keep (FinishPasskeyRegistration).
FinishPasskeySignIn
A passkey’s answer to a PasskeyRequest (FinishPasskeySignIn).
PasskeyCreation
What making a passkey needs: the platform’s options. User verification is required. Not on the wire: the client makes it from a PasskeyRegistrationBegun.
PasskeyInfo
One of the session user’s passkeys (ListPasskeys), the web UI’s as well as the apps’: the user sees every way they sign in, and the web UI’s me.passkeys lists the same ones.
PasskeyRegistrationBegun
A server’s answer to BeginPasskeyRegistration, on the wire: a nonce, not a challenge. PasskeyRegistrationBegun::for_server makes the PasskeyCreation the platform is given.
PasskeyRequest
What signing in with a passkey needs: the platform’s options. Not on the wire: the client makes it from a PasskeySignInBegun.
PasskeySignInBegun
A server’s answer to BeginPasskeySignIn and BeginConfirmPasskey, on the wire: a nonce, not a challenge. PasskeySignInBegun::for_server makes the PasskeyRequest the platform is given.

Constants§

LEGACY_APP_RP_ID
The relying party shared by all servers, with no server id. A passkey stored with it signs in nowhere: its user adds it again.
MAX_NAME_CHARS
The most characters a name a user types for a device may have: a passkey’s, an identity’s, a pairing’s label.
NONCE_LEN
Bytes of a nonce a server sends.

Functions§

app_passkey_challenge
The WebAuthn challenge for an app passkey ceremony with the server whose endpoint id is server, from the nonce it sent: SHA-256 of CHALLENGE_TAG, the 32 bytes of the id, then the nonce. The tag and the id are of fixed length, so nothing else hashes the same.
fit_name
name as a server takes it: trimmed and cut to MAX_NAME_CHARS characters, as the apps cut what is typed; None when nothing is left.
is_app_rp_id
Whether a passkey made for rp_id was made in an app: for a server’s relying party (ServerId::rp_id), or the one all shared before.