PasskiDemoServer

Client for the hosted PassKi demo relying party, so you can try passkeys in your app before you have a domain or a WebAuthn server. For evaluation only: demo users expire after 24 hours and the domain is shared.

The server creates every challenge and verifies every response with SimpleWebAuthn. This class only moves JSON between it and PassKi, exactly as your own server API would:

val demo = PasskiDemoServer()
passkeys.register(demo.registrationOptions("alice"))
.onSuccess { println(demo.verifyRegistration(it.json)) } // "verified by server ✓ signCount 0 …"
passkeys.signIn(demo.authenticationOptions())
.onSuccess { println(demo.verifyAuthentication(it.json)) }

The app must be associated with RP_ID: apply the Gradle plugin with passki { useDemoServer() } and run ./gradlew passkiSetup, which registers your package, signing key and iOS app ID with the demo server.

Every call throws DemoServerException when the server is unreachable or answers with an error.

Constructors

Link copied to clipboard
constructor(baseUrl: String = URL)

A client for the demo server at baseUrl (default: the hosted URL).

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The demo user from the last server-verified registration or sign-in; null before that.

Functions

Link copied to clipboard
suspend fun authenticationOptions(userHandle: String? = null): String

POST /api/demo/login/options: WebAuthn request options, ready for Passkeys.signIn. With userHandle the server lists that user's passkeys in allowCredentials; without it any discoverable passkey is accepted.

Link copied to clipboard
suspend fun registrationOptions(username: String? = null): String

POST /api/demo/register/options: WebAuthn creation options for a new demo user, ready for Passkeys.register.

Link copied to clipboard

GET /api/demo/server-config: the RP ID and every origin the demo server accepts, registered apps included.

Link copied to clipboard
suspend fun verifyAuthentication(responseJson: String): DemoVerdict

POST /api/demo/login/verify with PasskeyAssertion.json; returns the verdict with the new sign count.

Link copied to clipboard
suspend fun verifyRegistration(responseJson: String, shareFixtureAs: String? = null): DemoVerdict

POST /api/demo/register/verify with PasskeyRegistration.json; returns the server's verdict and remembers the account. With shareFixtureAs (android, ios, web or other) the raw response is also stored on the demo server for 7 days as a PassKi contract-test fixture; leave it null unless you want to share it.