# Overview

The `flutter_ts_authentication` is a Flutter plugin for Mosaic Authentication on Android and iOS. It provides secure authentication methods for Flutter applications, including PIN codes, biometrics, WebAuthn, TOTP, and device key signing. It wraps both Apple's public-private key authentication for passkeys on iOS and Google's Credential Manager API for passkeys on Android, delivering a unified native experience for FIDO2-based authentication.

Note
For additional integration guides such as configuring passkeys and advanced platform-specific features, refer to the native SDK documentation:

- [iOS documentation](https://developer.transmitsecurity.com/guides/webauthn/quick_start_sdk_ios/)
- [Android documentation](https://developer.transmitsecurity.com/guides/webauthn/quick_start_sdk_android/)


## Capabilities

- WebAuthn passkey registration and authentication
- Native biometric authentication (FaceID/TouchID on iOS, fingerprint/face on Android)
- Transaction signing with WebAuthn and native biometrics
- PIN code registration and authentication
- TOTP registration and code generation
- Device key signing
- Device info and WebAuthn support detection


## Requirements

- iOS 15.0+, Xcode 14+
- Android API 23+, compileSdkVersion 34+
- Flutter SDK


## Installation

Add the dependency to your `pubspec.yaml`:

```yaml
dependencies:
  flutter_ts_authentication:
    git:
      url: https://github.com/TransmitSecurity/flutter_ts_authentication.git
      ref: 0.0.3
```

Install dependencies:

```bash
flutter pub get
```

## Platform setup

iOS
Add biometric permission to `ios/Runner/Info.plist`:

```xml
<key>NSFaceIDUsageDescription</key>
<string>This app uses Face ID for secure authentication</string>
```

This module uses Swift Package Manager (SPM) for iOS dependencies. No additional CocoaPods setup is required.

Android
Add the Maven repository to `android/build.gradle`:

```gradle
allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://transmit.jfrog.io/artifactory/transmit-security-gradle-release-local/"
        }
    }
}
```

Update `android/app/build.gradle`:

```gradle
android {
    compileSdkVersion 34

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 34
    }
}
```

Add permissions to `android/app/src/main/AndroidManifest.xml`:

```xml
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.INTERNET" />
```

Make sure your `MainActivity` inherits from `FlutterFragmentActivity`:

```kotlin
import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
}
```

This is required for biometric authentication features and ensures compatibility with Android's biometric prompt APIs.

## Initialization

```dart
import 'package:flutter_ts_authentication/flutter_ts_authentication.dart';

final auth = FlutterTsAuthentication();

await auth.initializeSDK();
```

Alternatively, initialize with explicit parameters:

```dart
final initOptions = TSInitOptions(
  webAuthnInitOptions: TSWebAuthnInitOptions(
    startAuthentication: '/auth/webauthn/authenticate',
    startRegistration: '/auth/webauthn/register',
  ),
);

await auth.initialize(
  'CLIENT_ID',
  'your-domain.com',
  'https://api.transmitsecurity.io',
  initOptions
);
```

## Regional base URLs

| Region | Base URL |
|  --- | --- |
| US | `https://api.transmitsecurity.io/` |
| EU | `https://api.eu.transmitsecurity.io/` |
| Canada | `https://api.ca.transmitsecurity.io/` |
| Sandbox | `https://api.sbx.transmitsecurity.io/` |
| Custom domain | `https://<your-domain>.com/` (see [Custom domains](/guides/deployment/custom_domains)) |


## Next steps

Once initialized, implement authentication flows using the available [functions](/sdk-ref/flutter-ts-authentication/functions).