Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

package com.codename1.backend.security.webauthn

Passkeys: signing in with a credential an authenticator holds, as the Web Authentication specification defines it.

http.webAuthn(...) turns them on for a chain and serves the two ceremonies – registering a passkey for a user who is signed in, and signing in with one. Behind those endpoints is WebAuthnRelyingPartyOperations, which makes the options a client starts a ceremony from and verifies what the authenticator answered; an application that serves the ceremonies at addresses of its own uses it directly.

What is kept is a CredentialRecord for each passkey, in a UserCredentialRepository, and for each user the handle authenticators know them by, in a PublicKeyCredentialUserEntityRepository: both in memory or in the server’s database. Neither holds a secret.

The options and the answers travel as the specification’s JSON forms, byte strings in base64url, which is what a browser’s PublicKeyCredential.parseCreationOptionsFromJSON and toJSON(), and the Codename One client’s com.codename1.io.webauthn.WebAuthnClient, read and write.

Types

class CoseKeyA credential’s public key as an authenticator sends it – a COSE_Key, RFC 9052 – turned into what Crypto.verify takes: an algorithm name and a SubjectPublicKeyInfo.
class CredentialRecordOne registered passkey: what the server keeps of a credential, as the WebAuthn specification’s credential record lists it.
class InMemoryPublicKeyCredentialUserEntityRepositoryUser handles kept in this process: gone when it stops, so that every passkey registered before then finds no user after.
class InMemoryUserCredentialRepositoryCredentials kept in this process: gone when it stops, and unknown to any other server.
class JdbcPublicKeyCredentialUserEntityRepositoryUser handles kept in the server’s database, in the cn1_webauthn_user table of SecuritySchema.
class JdbcUserCredentialRepositoryCredentials kept in the server’s database, in the cn1_webauthn_credential table of SecuritySchema.
class PublicKeyCredentialCreationOptionsWhat a client is given to make a passkey with: the relying party, the user, a challenge, and what kind of credential is wanted.
class PublicKeyCredentialRequestOptionsWhat a client is given to sign in with a passkey: a challenge, the relying party, and – when the user said who they are first – which credentials may answer.
class PublicKeyCredentialRpEntityThe relying party of a passkey: the site a credential belongs to.
class PublicKeyCredentialUserEntityA user as passkeys know them: the name they sign in with, and the user handle – random bytes that stand for the account inside an authenticator, and that a sign-in without a user name hands back.
interface PublicKeyCredentialUserEntityRepositoryWhere each user’s passkey handle is kept; see PublicKeyCredentialUserEntity.
interface UserCredentialRepositoryWhere the passkeys users have registered are kept.
class WebAuthnAuthenticationWho signed in with a passkey.
class WebAuthnExceptionA passkey ceremony that was refused, with which check refused it.
class WebAuthnRelyingPartyOperationsThe two passkey ceremonies, as the relying party performs them: making the options a client starts from, and verifying what the authenticator answered.