register

abstract suspend fun register(parameters: PasskeysParameters): WebAuthnRegisterResponse

Registers a new passkey for the current user. Performs a two-step flow: calls POST /sdk/v1/webauthn/register/start to get creation options, invokes the platform credential API to create the passkey, then calls POST /sdk/v1/webauthn/register to complete registration. Requires an active session.

Kotlin (Android):

StytchConsumer.passkeys.register(
PasskeysParameters(
activity = activity,
domain = "example.com",
sessionDurationMinutes = 30,
)
)

iOS:

let params = PasskeysParameters(domain: "example.com", sessionDurationMinutes: 30)
let response = try await StytchConsumer.passkeys.register(params)

React Native:

StytchConsumer.passkeys.register({ domain: "example.com", sessionDurationMinutes: 30 })

Return

WebAuthnRegisterResponse containing the updated session and user.

Parameters

parameters
  • PasskeysParameters

  • domain — The relying party domain (e.g. "example.com").

  • sessionDurationMinutes? — Duration of the session to create after registration, in minutes.

  • preferImmediatelyAvailableCredentials — Whether to prefer credentials that are immediately available on this device.

  • (Android only) activity — The Activity used to present the credential creation dialog.

Throws

PasskeysUnsupportedError

if passkeys are not supported on the current platform.

StytchError

if registration fails.

if the coroutine is cancelled.