▸ initializeSDK(): Future<void>
Initializes the Authentication SDK using credentials from Info.plist (iOS) or native configuration (Android).
import 'package:flutter_ts_authentication/flutter_ts_authentication.dart';
final auth = FlutterTsAuthentication();
await auth.initializeSDK();▸ initialize(clientId, domain, baseUrl, initOptions): Future<void>
Initializes the SDK with explicit parameters and WebAuthn configuration.
| Name | Type | Description |
|---|---|---|
clientId | String | Your Mosaic client ID |
domain | String | Your application domain |
baseUrl | String | API endpoint URL |
initOptions | TSInitOptions | Configuration options containing WebAuthn settings |
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
);▸ registerPinCode(username, pinCode): Future<TSPinCodeRegistrationCompletion>
Registers a PIN code for the specified user. After successful registration, commit it using commitPinRegistration.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
pinCode | String | The PIN code to register |
TSPinCodeRegistrationCompletion—contains publicKeyId, publicKey, keyType, and contextIdentifier.
final result = await auth.registerPinCode('username', '123456');
await auth.commitPinRegistration(result.contextIdentifier);▸ commitPinRegistration(contextIdentifier): Future<void>
Commits a pending PIN code registration.
| Name | Type | Description |
|---|---|---|
contextIdentifier | String | The context identifier returned from registerPinCode |
▸ authenticatePinCode(username, pinCode, challenge): Future<TSPinCodeAuthenticationCompletion>
Authenticates a user with their registered PIN code.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
pinCode | String | The PIN code to authenticate with |
challenge | String | A server-generated challenge string |
TSPinCodeAuthenticationCompletion—contains publicKeyId, signature, and challenge.
final result = await auth.authenticatePinCode('username', '123456', 'challenge-string');▸ registerNativeBiometrics(username): Future<TSBiometricsRegistrationResult>
Registers native biometrics (FaceID/TouchID or fingerprint) for the specified user.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
TSBiometricsRegistrationResult—contains publicKey, publicKeyId, os, keyType, and optional attestation.
final result = await auth.registerNativeBiometrics('username');▸ authenticateNativeBiometrics(username, challenge): Future<TSBiometricsAuthenticationResult>
Authenticates a user using their registered biometrics.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
challenge | String | A server-generated challenge string |
TSBiometricsAuthenticationResult—contains publicKeyId and signature.
final result = await auth.authenticateNativeBiometrics('username', 'challenge-string');▸ unregisterNativeBiometrics(userId): Future<TSNativeBiometricsUnregisterResult>
Unregisters native biometrics for the specified user.
| Name | Type | Description |
|---|---|---|
userId | String | The user identifier |
TSNativeBiometricsUnregisterResult—contains publicKeyId of the unregistered biometric.
final result = await auth.unregisterNativeBiometrics('userId');▸ approvalNativeBiometrics(username, challenge): Future<TSBiometricsAuthenticationResult>
Performs biometric approval for transaction signing or sensitive operations.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
challenge | String | A server-generated challenge string |
TSBiometricsAuthenticationResult—contains publicKeyId and signature.
final result = await auth.approvalNativeBiometrics('username', 'challenge-string');▸ isWebAuthnSupported(): Future<bool>
Checks if WebAuthn is supported on the current device.
bool—true if WebAuthn is supported.
final isSupported = await auth.isWebAuthnSupported();▸ registerWebAuthn(username, displayName): Future<TSWebAuthnResult>
Registers a WebAuthn passkey for the specified user.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
displayName | String | Display name shown during passkey registration |
TSWebAuthnResult—contains result.
final result = await auth.registerWebAuthn('username', 'Display Name');▸ authenticateWebAuthn(username): Future<TSWebAuthnResult>
Authenticates a user using their registered WebAuthn passkey.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
TSWebAuthnResult—contains result.
final result = await auth.authenticateWebAuthn('username');▸ signWebauthnTransaction(username): Future<TSWebAuthnResult>
Signs a transaction using the user's WebAuthn credential.
| Name | Type | Description |
|---|---|---|
username | String | The user identifier |
TSWebAuthnResult—contains result.
final result = await auth.signWebauthnTransaction('username');▸ approvalWebAuthn(approvalData, username, options): Future<TSWebAuthnResult>
Performs WebAuthn approval with custom approval data.
| Name | Type | Description |
|---|---|---|
approvalData | Map<String, String> | Key-value pairs describing the operation to approve |
username | String | The user identifier |
options | List<String> | Additional options for the approval |
TSWebAuthnResult—contains result.
final approvalData = {'transaction': 'transfer', 'amount': '100'};
final options = <String>['option1', 'option2'];
final result = await auth.approvalWebAuthn(approvalData, 'username', options);▸ approvalWebAuthnWithData(authData, options): Future<TSWebAuthnResult>
Performs WebAuthn approval using raw authentication data.
| Name | Type | Description |
|---|---|---|
authData | TSWebAuthnAuthenticationData | Pre-obtained WebAuthn authentication data |
options | List<String> | Additional options for the approval |
TSWebAuthnResult—contains result.
final authData = TSWebAuthnAuthenticationData(data: {
'webauthnSessionId': 'session-id',
'credentialRequestOptions': {}
});
final result = await auth.approvalWebAuthnWithData(authData, options);▸ registerTOTP(uri, securityType): Future<TSTOTPRegistrationCompletion>
Registers a TOTP authenticator from a otpauth:// URI.
| Name | Type | Description |
|---|---|---|
uri | String | The TOTP provisioning URI (e.g., otpauth://totp/...) |
securityType | TSTOTPSecurityType | .biometric requires biometric authentication to generate codes; .none has no additional security |
TSTOTPRegistrationCompletion—contains issuer, label, and uuid.
final result = await auth.registerTOTP(
'otpauth://totp/Example:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example',
TSTOTPSecurityType.biometric
);▸ generateTOTPCode(uuid): Future<TSTOTPGenerateCodeCompletion>
Generates a TOTP code for standard time-based authentication.
| Name | Type | Description |
|---|---|---|
uuid | String | The TOTP identifier returned from registerTOTP |
TSTOTPGenerateCodeCompletion—contains the generated code.
final result = await auth.generateTOTPCode('your-totp-uuid');▸ generateTOTPCodeWithChallenge(uuid, challenge): Future<TSTOTPGenerateCodeCompletion>
Generates a TOTP code bound to a challenge for transaction signing or enhanced security scenarios.
| Name | Type | Description |
|---|---|---|
uuid | String | The TOTP identifier returned from registerTOTP |
challenge | String | A server-generated challenge string |
TSTOTPGenerateCodeCompletion—contains the generated code.
final result = await auth.generateTOTPCodeWithChallenge('your-totp-uuid', 'challenge-string');▸ signWithDeviceKey(challenge): Future<TSSignChallengeResult>
Signs a challenge using the device key for secure authentication and transaction validation.
| Name | Type | Description |
|---|---|---|
challenge | String | The challenge to sign |
TSSignChallengeResult—contains the signature.
final result = await auth.signWithDeviceKey('challenge-to-sign');▸ getDeviceInfo(): Future<DeviceInfo>
Retrieves the device's public key information.
DeviceInfo—contains publicKeyId and publicKey.
final deviceInfo = await auth.getDeviceInfo();▸ setLoggingEnabled(enabled): Future<bool>
Enables or disables SDK logging for debugging.
| Name | Type | Description |
|---|---|---|
enabled | bool | true to enable logging, false to disable |
bool—true if the configuration was applied successfully.
await auth.setLoggingEnabled(true);