For the complete documentation index, see llms.txt. This page is also available as Markdown.

Passkey

The Swift Passkey Module provides secure and streamlined user authentication and registration using modern passkey technology. It offers methods to check if a user exists, to authenticate users, and to register new users. Below is an overview of the available methods and an example of how to construct a PasskeyClientImpl.


Constructing PasskeyClientImpl

The PasskeyClientImpl class is a concrete implementation of the PasskeyClient protocol. It integrates with a network service and a passkey authentication service to perform user checks, authentication, and registration.

Example:

// Obtain a reference to an ASPresentationAnchor (e.g., your application's key window or a scene window)
let window: ASPresentationAnchor = /* your ASPresentationAnchor instance */

// Your API key and authentication server address
let apiKey = "YOUR_API_KEY"
let authServerAddress = "https://your-auth-server.com"

// Create an instance of PasskeyClientImpl
let passkeyClient: PasskeyClient = PasskeyClientImpl(window: window, apiKey: apiKey, authServerAddress: authServerAddress)

// Now you can use passkeyClient to call isUserExist, authenticate, and register methods.

1. isUserExist

The isUserExist() method checks whether a user with the specified username exists in the system. It makes a network call to verify the user’s existence and returns the result asynchronously via a completion handler.

Example:


2. authenticate

The authenticate() method initiates the passkey authentication process for a user. It retrieves authentication options from the network, starts the authentication flow via the passkey service, and verifies the response. The result is returned asynchronously.

Example:


3. register

The register() method starts the passkey-based registration process for a new user. It obtains registration options from the network, initiates the registration flow via the passkey service, and verifies the registration response. The result is returned asynchronously via a completion handler.

Example:

Last updated