### Installation Prefix and Bundle Directory Setup Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/windows/CMakeLists.txt Configures the installation directory to be next to the executable for in-place running and sets up the bundle data and library directories. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Sets the minimum CMake version and project name. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) ``` -------------------------------- ### Run Example App (Native) Source: https://github.com/corbado/flutter-passkeys/blob/main/CONTRIBUTING.md Run the example application for native platforms. ```bash melos run example-passkeys-native ``` -------------------------------- ### Run Example App (Web) Source: https://github.com/corbado/flutter-passkeys/blob/main/CONTRIBUTING.md Run the example application for the web platform. ```bash melos run example-passkeys-web ``` -------------------------------- ### Installing Application Executable Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Installs the application executable to the root of the installation prefix. This makes the main application binary available in the bundle. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Appium and Flutter Drivers Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/README.md Install Appium globally and then install the necessary drivers for Flutter integration and Android/iOS automation. ```shell npm install -g appium appium driver install --source=npm appium-flutter-driver appium driver install uiautomator2 appium driver install --source=npm appium-flutter-integration-driver ``` -------------------------------- ### connectLoginStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Starts an initialized connect login process. ```APIDOC ## POST /v2/connect/login/start ### Description Starts an initialized connect login process. ### Method POST ### Endpoint /v2/connect/login/start ### Parameters #### Request Body - **connectLoginStartReq** (ConnectLoginStartReq) - Required - ### Response #### Success Response (200) - **ConnectLoginStartRsp** (ConnectLoginStartRsp) - ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### connectAppendStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Starts an initialized connect passkey append process. ```APIDOC ## POST /v2/connect/append/start ### Description Starts an initialized connect passkey append process. ### Method POST ### Endpoint /v2/connect/append/start ### Parameters #### Request Body - **connectAppendStartReq** (ConnectAppendStartReq) - Required - ### Response #### Success Response (200) - **ConnectAppendStartRsp** (ConnectAppendStartRsp) - ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### connectManageInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Initializes the passkey management process for a user. This method is used to start a flow that might involve user authentication or setup for passkey operations. ```APIDOC ## connectManageInit ### Description Initializes the passkey management process. ### Method POST ### Endpoint /connect/manage/init ### Parameters #### Request Body - **connectManageInitReq** (ConnectManageInitReq) - Required - The request body for initializing connect management. ### Request Example ```dart // Assuming connectManageInitReq is already defined and populated final response = api.connectManageInit(connectManageInitReq); ``` ### Response #### Success Response (200) - **ConnectManageInitRsp** (ConnectManageInitRsp) - The response object containing initialization details. ### Response Example ```json { "example": "ConnectManageInitRsp object" } ``` ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### Build and Install iOS App for Testing Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/README.md Build the iOS application for simulator with test mode enabled and install it on a device. Ensure Flutter dependencies are installed first. ```shell flutter pub get flutter build ios --simulator --dart-define=TEST_MODE=true flutter install --device-id= ``` -------------------------------- ### Build and Install Android App for Testing Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/README.md Build the Android application with test mode enabled and install it on a device. Ensure Flutter dependencies are installed first. ```shell flutter pub get flutter build apk --debug --dart-define=TEST_MODE=true flutter install --device-id= ``` -------------------------------- ### signupInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initializes the signup process with the provided request data, returning a ProcessResponse. This is the starting point for new user registrations. ```APIDOC ## signupInit > ProcessResponse signupInit(signupInitReq) ### Description Initializes the signup process with the provided request data, returning a ProcessResponse. This is the starting point for new user registrations. ### Parameters #### Path Parameters - **signupInitReq** (SignupInitReq) - Required - The request object containing signup initialization parameters. ### Return type [**ProcessResponse**](ProcessResponse.md) ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### Example ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getAuthApi(); final SignupInitReq signupInitReq = ; // SignupInitReq | try { final response = api.signupInit(signupInitReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->signupInit: $e\n'); } ``` ``` -------------------------------- ### processInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initializes a new authentication process. This is the starting point for most authentication flows. ```APIDOC ## POST /v2/auth/process/init ### Description Initializes a new authentication process. ### Method POST ### Endpoint /v2/auth/process/init ### Parameters #### Request Body - **processInitReq** (ProcessInitReq) - Required - ### Request Example ```dart import 'package:corbado_frontend_api_client/api.dart'; final api = CorbadoFrontendApiClient().getAuthApi(); final ProcessInitReq processInitReq = ; // ProcessInitReq | try { final response = api.processInit(processInitReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->processInit: $e\n'); } ``` ### Response #### Success Response (200) - **body** (ProcessResponse) - ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Configuring Installation Prefix for Bundle Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Sets the installation prefix to a bundle directory within the build directory. This makes the installation process create a relocatable bundle. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth_firebase/example/linux/CMakeLists.txt Installs Flutter assets by first removing any existing directory and then copying the new assets. This ensures a clean installation of the Flutter asset bundle. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install( CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Start Appium Server Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/README.md Start the Appium server on the specified port (4567) to enable automated testing. ```shell appium -p 4567 ``` -------------------------------- ### PasskeyAuthenticator - Registration Example Source: https://context7.com/corbado/flutter-passkeys/llms.txt Demonstrates the sign-up process using `PasskeyAuthenticator.register()`. It involves fetching a challenge from the server, parsing it, triggering the platform authenticator, and sending the attestation back to the server. ```APIDOC ## `PasskeyAuthenticator.register()` ### Description Handles the WebAuthn registration ceremony, allowing users to create a new passkey. ### Method `Future register(RegisterRequestType request)` ### Parameters #### Request Body - **request** (RegisterRequestType) - Required - The registration options obtained from the relying party server. ### Request Example ```dart Future exampleSignUp(String email) async { final authenticator = PasskeyAuthenticator(debugMode: true); // 1. Fetch registration challenge from your relying party server (your backend). // The server returns JSON conforming to PublicKeyCredentialCreationOptions. final String creationOptionsJson = await myBackend.startRegistration(email); // 2. Parse the JSON into the typed request object. final RegisterRequestType request = RegisterRequestType.fromJsonString(creationOptionsJson); try { // 3. Trigger the platform authenticator (Face ID / fingerprint / Windows Hello …). final RegisterResponseType response = await authenticator.register(request); // 4. Send the attestation back to your relying party server to complete registration. await myBackend.finishRegistration(response.toJsonString()); } on PasskeyAuthCancelledException { print('User cancelled – show a retry option'); } on MissingGoogleSignInException { print('Android: user must be signed in to a Google account'); } on DomainNotAssociatedException catch (e) { print('App is not associated with relying party domain: $e'); } on NoCreateOptionException catch (e) { print('No passkey provider available on this device: $e'); } on MalformedBase64UrlChallenge { print('Challenge from server is not valid Base64URL – fix your backend'); } } ``` ### Response #### Success Response - **RegisterResponseType** - Contains the attestation object and client data for server verification. #### Response Example (See Request Example for the full flow) ``` -------------------------------- ### Start Connect Login Process Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Call this method to begin an initialized connect login. Requires a configured API key. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectLoginStartReq connectLoginStartReq = ; // ConnectLoginStartReq | try { final response = api.connectLoginStart(connectLoginStartReq); print(response); } catch on DioException (e) { print('Exception when calling CorbadoConnectApi->connectLoginStart: $e\n'); } ``` -------------------------------- ### Initiate Connect Login Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Use this method to start the login process. Ensure API key authorization is configured. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectLoginInitReq connectLoginInitReq = ; // ConnectLoginInitReq | try { final response = api.connectLoginInit(connectLoginInitReq); print(response); } catch on DioException (e) { print('Exception when calling CorbadoConnectApi->connectLoginInit: $e\n'); } ``` -------------------------------- ### connectLoginStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Starts an initialized connect login process. This method is called after the login process has been initialized. ```APIDOC ## connectLoginStart ### Description Starts an initialized connect login process. This method is called after the login process has been initialized. ### Method POST ### Endpoint /connect/login/start ### Parameters #### Request Body - **connectLoginStartReq** (ConnectLoginStartReq) - Required - The request object containing details for starting the login process. ### Request Example ```dart import 'package:corbado_frontend_api_client/api.dart'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectLoginStartReq connectLoginStartReq = ConnectLoginStartReq(); // Populate with actual data try { final response = await api.connectLoginStart(connectLoginStartReq); print(response); } catch (e) { print('Exception when calling CorbadoConnectApi->connectLoginStart: $e\n'); } ``` ### Response #### Success Response (200) - **ConnectLoginStartRsp** (ConnectLoginStartRsp) - The response object containing the result of starting the login process. ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### passkeyAppendStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Starts the process of appending a new passkey to the user's account, requiring a PasskeyAppendStartReq and returning a ProcessResponse. ```APIDOC ## POST /auth/passkey/append/start ### Description Starts the process of appending a new passkey. ### Method POST ### Endpoint /auth/passkey/append/start ### Parameters #### Request Body - **passkeyAppendStartReq** (PasskeyAppendStartReq) - Required - The request body for starting the passkey append. ### Response #### Success Response (200) - **ProcessResponse** (ProcessResponse) - The response from starting the passkey append. ### Authorization - bearerAuth - projectID ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### PasskeyAuthenticator - Authentication Example Source: https://context7.com/corbado/flutter-passkeys/llms.txt Demonstrates the sign-in process using `PasskeyAuthenticator.authenticate()`. It involves fetching assertion options from the server, triggering the platform authenticator, and sending the assertion back to the server. ```APIDOC ## `PasskeyAuthenticator.authenticate()` ### Description Handles the WebAuthn assertion ceremony, allowing users to log in using an existing passkey. ### Method `Future authenticate(AuthenticateRequestType request)` ### Parameters #### Request Body - **request** (AuthenticateRequestType) - Required - The assertion options obtained from the relying party server. ### Request Example ```dart Future exampleSignIn(String email) async { final authenticator = PasskeyAuthenticator(); final String assertionOptionsJson = await myBackend.startLogin(email); final AuthenticateRequestType request = AuthenticateRequestType.fromJsonString(assertionOptionsJson); try { final AuthenticateResponseType response = await authenticator.authenticate(request); await myBackend.finishLogin(response.toJsonString()); } on NoCredentialsAvailableException { print('No passkey found – offer email-OTP fallback'); } on PasskeyAuthCancelledException { print('User cancelled'); } on TimeoutException catch (e) { print('Operation timed out: $e'); } } ``` ### Response #### Success Response - **AuthenticateResponseType** - Contains the authenticator assertion and client data for server verification. #### Response Example (See Request Example for the full flow) ``` -------------------------------- ### Install Node.js Dependencies and Run Tests Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/README.md Install required Node.js dependencies within the 'tests' directory and then run automated tests for Android or iOS, specifying the device ID. ```shell cd tests npm install npm run test:android -- --deviceName= npm run test:ios -- --deviceName= ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/windows/CMakeLists.txt Installs any bundled plugin libraries to the library directory within the application bundle, if they exist. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Defining Installation Directories Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Sets variables for the data and library directories within the installation bundle. These are used for placing application assets and libraries. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### connectLoginInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Starts the Connect login process by initializing the authentication flow. This method prepares the system for user login. ```APIDOC ## connectLoginInit ### Description Initializes a connect process for login. ### Method POST ### Endpoint /connect/login/init ### Parameters #### Request Body - **connectLoginInitReq** (ConnectLoginInitReq) - Required - The request body containing details to initialize the login process. ### Request Example ```dart import 'package:corbado_frontend_api_client/api.dart'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectLoginInitReq connectLoginInitReq = ConnectLoginInitReq(); // Populate with actual data try { final response = await api.connectLoginInit(connectLoginInitReq); print(response); } catch (e) { print('Exception when calling connectLoginInit: $e'); } ``` ### Response #### Success Response (200) - **ConnectLoginInitRsp** (ConnectLoginInitRsp) - The response object containing details for the initialized login session. #### Response Example ```json { "example": "ConnectLoginInitRsp object" } ``` ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### Installing Flutter Library Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Installs the main Flutter library file to the library directory within the bundle. This makes the core Flutter runtime available. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### CorbadoConnectApi: connectLoginStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Starts the connection login process. ```APIDOC ## POST /v2/connect/login/start ### Description Starts the connection login process. ### Method POST ### Endpoint /v2/connect/login/start ``` -------------------------------- ### Installing Native Assets Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth_firebase/example/linux/CMakeLists.txt Installs native assets provided by the build.dart script from all packages into the library directory of the bundle. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Web Setup: Include bundle.js Source: https://context7.com/corbado/flutter-passkeys/llms.txt The `passkeys_web` implementation requires a JavaScript shim. Include the `bundle.js` script in your `web/index.html` before the Flutter bootstrap script to avoid runtime errors. ```html My App ``` -------------------------------- ### Connect Append Init Example Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Initializes a passkey append process. Ensure API key authorization is configured before use. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectAppendInitReq connectAppendInitReq = ; // ConnectAppendInitReq | try { final response = api.connectAppendInit(connectAppendInitReq); print(response); } catch on DioException (e) { print('Exception when calling CorbadoConnectApi->connectAppendInit: $e\n'); } ``` -------------------------------- ### CorbadoConnectApi: connectAppendStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Starts the connection append process. ```APIDOC ## POST /v2/connect/append/start ### Description Starts the connection append process. ### Method POST ### Endpoint /v2/connect/append/start ``` -------------------------------- ### Installing Bundled Plugin Libraries Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Installs any bundled plugin libraries to the library directory within the bundle. This ensures that all necessary plugin code is included. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### SignupInitScreen Usage Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/MIGRATION.md Example of how to use the SignupInitBlock within a Flutter screen to handle user signup initialization. It demonstrates accessing block data, handling errors, and invoking methods like `submitSignupInit` and `navigateToLogin`. ```APIDOC ## SignupInitScreen ### Description A Flutter screen that implements `CorbadoScreen` to manage the initial signup flow. It allows users to input their email and provides options to submit the signup or navigate to the login screen. ### Usage ```dart import 'package:corbado_auth/corbado_auth.dart'; import 'package:flutter/material.dart'; class SignupInitScreen extends HookWidget implements CorbadoScreen { final SignupInitBlock block; SignupInitScreen(this.block); @override Widget build(BuildContext context) { final emailController = useTextEditingController(text: block.data.email.value); // Error handling logic useEffect(() => { WidgetsBinding.instance.addPostFrameCallback((_) { if (block.error != null) { showNotificationError(context, block.error!.translatedError); } }); }, [block.error]); return Column( children: [ // Display errors if any MaybeGenericError(message: block.error?.translatedError), // Email input field TextField(controller: emailController), // Submit button FilledTextButton( isLoading: block.data.primaryLoading, onTap: () async { await block.submitSignupInit(email: emailController.text, fullName: 'fixed'); }, content: 'Sign up', ), // Navigation to login OutlinedTextButton( onTap: block.navigateToLogin, content: 'I already have an account', ), ], ); } } ``` ### Methods Invoked - `block.submitSignupInit(email: String, fullName: String)`: Submits the signup initialization request. - `block.navigateToLogin()`: Navigates the user to the login screen. ### Data Accessed - `block.data.email.value`: Retrieves the current email value. - `block.data.primaryLoading`: Checks the primary loading state for the submit action. - `block.error`: Accesses any errors that occurred during the process. ``` -------------------------------- ### Signup Initialization Screen in Flutter Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/MIGRATION.md Example of a Flutter screen implementing `SignupInitBlock` for user signup initialization. It handles email input, error display, and submission logic. ```dart import 'package:corbado_auth/corbado_auth.dart'; import 'package:corbado_auth_example/screens/helper.dart'; import 'package:corbado_auth_example/widgets/filled_text_button.dart'; import 'package:corbado_auth_example/widgets/generic_error.dart'; import 'package:corbado_auth_example/widgets/outlined_text_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; class SignupInitScreen extends HookWidget implements CorbadoScreen { final SignupInitBlock block; // Block initialization SignupInitScreen(this.block); Widget build(BuildContext context) { // Get the email from the block final email = block.data.email; final emailController = useTextEditingController(text: email.value); useEffect(() { WidgetsBinding.instance.addPostFrameCallback((_) { final maybeError = block.error; if (maybeError != null) { showNotificationError(context, maybeError.translatedError); } }); }, [block.error]); return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ // You can show the error message using `block.error` MaybeGenericError(message: block.error?.translatedError), ... const SizedBox(height: 20), SizedBox( width: double.infinity, height: 50, child: FilledTextButton( // You can get the loading state using `block.data.primaryLoading` isLoading: block.data.primaryLoading, onTap: () async { // You can submit the signup using `block.submitSignupInit` await block.submitSignupInit(email: emailController.text, fullName: 'fixed'); }, content: 'Sign up', ), ), const SizedBox(height: 10), SizedBox( width: double.infinity, height: 50, child: OutlinedTextButton( // You can navigate to the login screen using `block.navigateToLogin` onTap: block.navigateToLogin, content: 'I already have an account', ), ), ] , ); } } ``` -------------------------------- ### Run Flutter Example with Corbado Project ID Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/doc/android_configuration.md Execute the Flutter example application, providing your Corbado project ID as a Dart define. Ensure you have a screen lock set up on your device and are using API 33 (Android 13) for virtual devices. ```bash flutter run --dart-define=CORBADO_PROJECT_ID= lib/main.dart ``` -------------------------------- ### Initiate Sign-up with submitSignupInit Source: https://context7.com/corbado/flutter-passkeys/llms.txt Starts the registration process by sending the user's email and optional full name to the Corbado API. The `CorbadoAuthComponent` automatically advances the UI to the next step upon successful server response. ```dart // Inside your custom SignupInitBlock UI widget: await block.submitSignupInit( email: 'alice@example.com', fullName: 'Alice Smith', // optional; shown if enabled in Corbado console ); // Stream advances to PasskeyAppendBlock automatically. ``` -------------------------------- ### Setting Installation Prefix for Bundle Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth_firebase/example/linux/CMakeLists.txt Configures the installation prefix to a 'bundle' directory within the build directory for creating a relocatable application bundle. It also ensures a clean bundle directory on each build. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### currentUserPasskeyAppendStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Initiates the process of appending a new passkey to the user's account. This starts the passkey registration flow. ```APIDOC ## POST /v2/me/passkeys/append/start ### Description Initiates the process of appending a new passkey to the user's account. ### Method POST ### Endpoint /v2/me/passkeys/append/start ``` -------------------------------- ### Passkey Registration Example Source: https://context7.com/corbado/flutter-passkeys/llms.txt Handles the WebAuthn registration ceremony, including fetching challenges, triggering the authenticator, and sending attestation to the server. Catches specific authentication exceptions. ```dart import 'package:passkeys/authenticator.dart'; import 'package:passkeys/types.dart'; Future exampleSignUp(String email) async { final authenticator = PasskeyAuthenticator(debugMode: true); // enables PasskeysDoctor // 1. Fetch registration challenge from your relying party server (your backend). // The server returns JSON conforming to PublicKeyCredentialCreationOptions. final String creationOptionsJson = await myBackend.startRegistration(email); // 2. Parse the JSON into the typed request object. final RegisterRequestType request = RegisterRequestType.fromJsonString(creationOptionsJson); // request.relyingParty.id == "example.com" // request.challenge == "" // request.user.id == "" try { // 3. Trigger the platform authenticator (Face ID / fingerprint / Windows Hello …). final RegisterResponseType response = await authenticator.register(request); // 4. Send the attestation back to your relying party server to complete registration. await myBackend.finishRegistration(response.toJsonString()); } on PasskeyAuthCancelledException { print('User cancelled – show a retry option'); } on MissingGoogleSignInException { print('Android: user must be signed in to a Google account'); } on DomainNotAssociatedException catch (e) { print('App is not associated with relying party domain: $e'); } on NoCreateOptionException catch (e) { print('No passkey provider available on this device: $e'); } on MalformedBase64UrlChallenge { print('Challenge from server is not valid Base64URL – fix your backend'); } } ``` -------------------------------- ### currentUserIdentifierVerifyStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Initiates the verification process for a user identifier. This starts the flow to confirm the ownership or validity of an identifier. ```APIDOC ## POST /v2/me/identifier/verify/start ### Description Initiates the verification process for a user identifier. ### Method POST ### Endpoint /v2/me/identifier/verify/start ``` -------------------------------- ### AuthApi->blockSkip Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md This example demonstrates how to call the `blockSkip` method from the `AuthApi` to perform an authentication-related operation. It includes basic error handling for `DioException`. ```APIDOC ## AuthApi->blockSkip ### Description This method is part of the authentication API and is used to block or skip a certain authentication flow. ### Method This is a client-side SDK method, not a direct HTTP call. ### Endpoint N/A (SDK method) ### Parameters None explicitly documented for this SDK method call. ### Request Example ```dart import 'package:corbado_frontend_api_client/corbado_frontend_api_client.dart'; final api = CorbadoFrontendApiClient().getAuthApi(); try { final response = await api.blockSkip(); print(response); } catch on DioException (e) { print("Exception when calling AuthApi->blockSkip: $e\n"); } ``` ### Response #### Success Response The response type is not explicitly defined in the provided text, but it is printed to the console. #### Response Example ```json // Example response structure not provided in source text ``` ``` -------------------------------- ### Connect Append Finish Example Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Finishes an initialized passkey append process. Ensure API key authorization is configured before use. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getCorbadoConnectApi(); final ConnectAppendFinishReq connectAppendFinishReq = ; // ConnectAppendFinishReq | try { final response = api.connectAppendFinish(connectAppendFinishReq); print(response); } catch on DioException (e) { print('Exception when calling CorbadoConnectApi->connectAppendFinish: $e\n'); } ``` -------------------------------- ### LoginInitBlock.submitLogin() / LoginInitBlock.initConditionalUI() Source: https://context7.com/corbado/flutter-passkeys/llms.txt Initiates the login process. `submitLogin` is used for manual login after a user identifier is provided, while `initConditionalUI` automatically starts a background WebAuthn assertion for a seamless login experience when a challenge is available. ```APIDOC ## `LoginInitBlock.submitLogin()` / `LoginInitBlock.initConditionalUI()` — initiate login `submitLogin()` sends the user's identifier to the server and advances the stream. `initConditionalUI()` is called automatically during block initialisation when a challenge is available; it starts a background WebAuthn assertion that surfaces through the OS autofill UI (no explicit user tap required on Android). ```dart // Manual login (user typed their email): await block.submitLogin(loginIdentifier: 'alice@example.com'); // Conditional UI is started automatically, but can also be triggered explicitly: await block.initConditionalUI(); // If the user's device has a matching passkey, the OS shows a bottom sheet / autofill suggestion. // On success, CorbadoAuthComponent advances to the completed state. ``` ``` -------------------------------- ### Start Passkey Login with Corbado API Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initiates the passkey login flow. This method requires a `PasskeyLoginStartReq` object to be provided. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getAuthApi(); final PasskeyLoginStartReq passkeyLoginStartReq = ; // PasskeyLoginStartReq | try { final response = api.passkeyLoginStart(passkeyLoginStartReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->passkeyLoginStart: $e\n'); } ``` -------------------------------- ### processGet Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initiates or continues a process, potentially for authentication or verification, returning a ProcessResponse. It accepts an optional preferredBlock parameter to guide the process. ```APIDOC ## processGet > ProcessResponse processGet(preferredBlock) ### Description Initiates or continues a process, potentially for authentication or verification, returning a ProcessResponse. It accepts an optional preferredBlock parameter to guide the process. ### Parameters #### Path Parameters - **preferredBlock** (BlockType) - Optional - Specifies a preferred block type for the process. ### Return type [**ProcessResponse**](ProcessResponse.md) ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### Example ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getAuthApi(); final BlockType preferredBlock = ; // BlockType | try { final response = api.processGet(preferredBlock); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->processGet: $e\n'); } ``` ``` -------------------------------- ### Passkey Authentication Example Source: https://context7.com/corbado/flutter-passkeys/llms.txt Handles the WebAuthn assertion ceremony for login, including fetching assertion options, triggering the authenticator, and verifying the response with the server. Includes error handling for common authentication issues. ```dart Future exampleSignIn(String email) async { final authenticator = PasskeyAuthenticator(); final String assertionOptionsJson = await myBackend.startLogin(email); final AuthenticateRequestType request = AuthenticateRequestType.fromJsonString(assertionOptionsJson); try { final AuthenticateResponseType response = await authenticator.authenticate(request); await myBackend.finishLogin(response.toJsonString()); } on NoCredentialsAvailableException { print('No passkey found – offer email-OTP fallback'); } on PasskeyAuthCancelledException { print('User cancelled'); } on TimeoutException catch (e) { print('Operation timed out: $e'); } } ``` -------------------------------- ### Initialize CorbadoAuth SDK Source: https://context7.com/corbado/flutter-passkeys/llms.txt The entry point for the high-level auth SDK. Initializes the `PasskeyAuthenticator`, restores sessions, and starts token refresh. Must be awaited before using other `CorbadoAuth` methods. ```dart import 'package:corbado_auth/corbado_auth.dart'; import 'package:flutter/material.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final corbadoAuth = CorbadoAuth(); await corbadoAuth.init( projectId: 'pro-1234567890123456789', // from app.corbado.com debugMode: true, // enables PasskeysDoctor diagnostics telemetryDisabled: false, // opt-in telemetry (default: enabled) ); runApp(MyApp(corbadoAuth: corbadoAuth)); } ``` -------------------------------- ### Cleaning Build Bundle Directory on Install Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Removes the build bundle directory before installation to ensure a clean state. This is executed as an install code step. ```cmake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### signupInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initializes the signup process for a new user. This is the first step in creating a new account. ```APIDOC ## POST /v2/auth/signup/init ### Description Initializes the signup process for a new user. ### Method POST ### Endpoint /v2/auth/signup/init ### Parameters #### Request Body - **signupInitReq** (SignupInitReq) - Required - ### Request Example ```dart import 'package:corbado_frontend_api_client/api.dart'; final api = CorbadoFrontendApiClient().getAuthApi(); final SignupInitReq signupInitReq = ; // SignupInitReq | try { final response = api.signupInit(signupInitReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->signupInit: $e\n'); } ``` ### Response #### Success Response (200) - **body** (ProcessResponse) - ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### AuthApi: signupInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Initializes the signup process. ```APIDOC ## POST /v2/auth/signup/init ### Description Initializes the signup process. ### Method POST ### Endpoint /v2/auth/signup/init ``` -------------------------------- ### Install AOT Library Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compilation library on non-Debug builds (Profile and Release). ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Native Assets Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/passkeys/passkeys/example/windows/CMakeLists.txt Installs native assets provided by build.dart from all packages into the application's library directory. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### AuthApi: processInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/README.md Initializes a new authentication process. ```APIDOC ## POST /v2/auth/process/init ### Description Initializes a new authentication process. ### Method POST ### Endpoint /v2/auth/process/init ``` -------------------------------- ### Dart: Call AuthApi.signupInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initializes the signup process with the provided request object. Ensure API key authorization is set up. Includes basic error handling for DioExceptions. ```dart import 'package:corbado_frontend_api_client/api.dart'; // TODO Configure API key authorization: projectID //defaultApiClient.getAuthentication('projectID').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed //defaultApiClient.getAuthentication('projectID').apiKeyPrefix = 'Bearer'; final api = CorbadoFrontendApiClient().getAuthApi(); final SignupInitReq signupInitReq = ; // SignupInitReq | try { final response = api.signupInit(signupInitReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->signupInit: $e\n'); } ``` -------------------------------- ### passkeyLoginStart Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initiates the passkey login process. This prepares the system for user authentication using a passkey. ```APIDOC ## POST /v2/auth/passkey/login/start ### Description Initiates the passkey login process. ### Method POST ### Endpoint /v2/auth/passkey/login/start ### Parameters #### Request Body - **passkeyLoginStartReq** (PasskeyLoginStartReq) - Required - ### Request Example ```dart import 'package:corbado_frontend_api_client/api.dart'; final api = CorbadoFrontendApiClient().getAuthApi(); final PasskeyLoginStartReq passkeyLoginStartReq = ; // PasskeyLoginStartReq | try { final response = api.passkeyLoginStart(passkeyLoginStartReq); print(response); } catch on DioException (e) { print('Exception when calling AuthApi->passkeyLoginStart: $e\n'); } ``` ### Response #### Success Response (200) - **body** (ProcessResponse) - ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Identifier Verify Start Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/AuthApi.md Initiates the identifier verification process. This typically starts a flow to verify a user's identifier. ```APIDOC ## POST /identifier/verify/start ### Description Initiates the identifier verification process. ### Method POST ### Endpoint /identifier/verify/start ### Parameters #### Request Body - **identifierVerifyStartReq** (IdentifierVerifyStartReq) - Required - The request body containing the details to start the verification. ### Response #### Success Response (200) - **ProcessResponse** (ProcessResponse) - The response indicating the status of the identifier verification initiation. ### Authorization - bearerAuth - projectID ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### CorbadoAuth.init() Source: https://context7.com/corbado/flutter-passkeys/llms.txt Initializes the Corbado SDK. This is the entry point and must be awaited before using other CorbadoAuth methods. It configures the PasskeyAuthenticator, restores sessions, and sets up token refreshing. ```APIDOC ## CorbadoAuth.init() ### Description The entry point for the high-level auth SDK. Accepts a Corbado project ID (obtained from [app.corbado.com](https://app.corbado.com)), initialises the `PasskeyAuthenticator`, restores a previously persisted session from secure storage, and starts the automatic token-refresh mechanism. Must be `await`ed before using any other `CorbadoAuth` method. ### Method `init(projectId: String, {bool debugMode = false, bool telemetryDisabled = false})` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart import 'package:corbado_auth/corbado_auth.dart'; import 'package:flutter/material.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final corbadoAuth = CorbadoAuth(); await corbadoAuth.init( projectId: 'pro-1234567890123456789', // from app.corbado.com debugMode: true, // enables PasskeysDoctor diagnostics telemetryDisabled: false, // opt-in telemetry (default: enabled) ); runApp(MyApp(corbadoAuth: corbadoAuth)); } ``` ### Response #### Success Response (200) None (initialization is asynchronous and does not return a value on success) #### Response Example None ``` -------------------------------- ### Re-copying Assets Directory on Install Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Removes and then re-copies the assets directory during installation. This prevents stale asset files from remaining in the bundle. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### connectManageInit Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_api_client/lib/frontendapi/doc/CorbadoConnectApi.md Initializes the passkey management process. ```APIDOC ## POST /v2/connect/manage/init ### Description Initializes the passkey management process. ### Method POST ### Endpoint /v2/connect/manage/init ### Parameters #### Request Body - **connectManageInitReq** (ConnectManageInitReq) - Required - ### Response #### Success Response (200) - **ConnectManageInitRsp** (ConnectManageInitRsp) - ### Authorization [bearerAuth](../README.md#bearerAuth), [projectID](../README.md#projectID) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### Installing ICU Data File Source: https://github.com/corbado/flutter-passkeys/blob/main/packages/corbado_auth/example/linux/CMakeLists.txt Installs the ICU data file to the data directory within the bundle. This is necessary for internationalization support. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ```