Skip to content

initializeSDK

initializeSDK(): Future<void>

Initializes the Authentication SDK using credentials from Info.plist (iOS) or native configuration (Android).

Example

import 'package:flutter_ts_authentication/flutter_ts_authentication.dart';

final auth = FlutterTsAuthentication();
await auth.initializeSDK();

initialize

initialize(clientId, domain, baseUrl, initOptions): Future<void>

Initializes the SDK with explicit parameters and WebAuthn configuration.

Parameters

NameTypeDescription
clientIdStringYour Mosaic client ID
domainStringYour application domain
baseUrlStringAPI endpoint URL
initOptionsTSInitOptionsConfiguration options containing WebAuthn settings

Example

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

registerPinCode(username, pinCode): Future<TSPinCodeRegistrationCompletion>

Registers a PIN code for the specified user. After successful registration, commit it using commitPinRegistration.

Parameters

NameTypeDescription
usernameStringThe user identifier
pinCodeStringThe PIN code to register

Returns

TSPinCodeRegistrationCompletion—contains publicKeyId, publicKey, keyType, and contextIdentifier.

Example

final result = await auth.registerPinCode('username', '123456');
await auth.commitPinRegistration(result.contextIdentifier);

commitPinRegistration

commitPinRegistration(contextIdentifier): Future<void>

Commits a pending PIN code registration.

Parameters

NameTypeDescription
contextIdentifierStringThe context identifier returned from registerPinCode

authenticatePinCode

authenticatePinCode(username, pinCode, challenge): Future<TSPinCodeAuthenticationCompletion>

Authenticates a user with their registered PIN code.

Parameters

NameTypeDescription
usernameStringThe user identifier
pinCodeStringThe PIN code to authenticate with
challengeStringA server-generated challenge string

Returns

TSPinCodeAuthenticationCompletion—contains publicKeyId, signature, and challenge.

Example

final result = await auth.authenticatePinCode('username', '123456', 'challenge-string');

registerNativeBiometrics

registerNativeBiometrics(username): Future<TSBiometricsRegistrationResult>

Registers native biometrics (FaceID/TouchID or fingerprint) for the specified user.

Parameters

NameTypeDescription
usernameStringThe user identifier

Returns

TSBiometricsRegistrationResult—contains publicKey, publicKeyId, os, keyType, and optional attestation.

Example

final result = await auth.registerNativeBiometrics('username');

authenticateNativeBiometrics

authenticateNativeBiometrics(username, challenge): Future<TSBiometricsAuthenticationResult>

Authenticates a user using their registered biometrics.

Parameters

NameTypeDescription
usernameStringThe user identifier
challengeStringA server-generated challenge string

Returns

TSBiometricsAuthenticationResult—contains publicKeyId and signature.

Example

final result = await auth.authenticateNativeBiometrics('username', 'challenge-string');

unregisterNativeBiometrics

unregisterNativeBiometrics(userId): Future<TSNativeBiometricsUnregisterResult>

Unregisters native biometrics for the specified user.

Parameters

NameTypeDescription
userIdStringThe user identifier

Returns

TSNativeBiometricsUnregisterResult—contains publicKeyId of the unregistered biometric.

Example

final result = await auth.unregisterNativeBiometrics('userId');

approvalNativeBiometrics

approvalNativeBiometrics(username, challenge): Future<TSBiometricsAuthenticationResult>

Performs biometric approval for transaction signing or sensitive operations.

Parameters

NameTypeDescription
usernameStringThe user identifier
challengeStringA server-generated challenge string

Returns

TSBiometricsAuthenticationResult—contains publicKeyId and signature.

Example

final result = await auth.approvalNativeBiometrics('username', 'challenge-string');

isWebAuthnSupported

isWebAuthnSupported(): Future<bool>

Checks if WebAuthn is supported on the current device.

Returns

booltrue if WebAuthn is supported.

Example

final isSupported = await auth.isWebAuthnSupported();

registerWebAuthn

registerWebAuthn(username, displayName): Future<TSWebAuthnResult>

Registers a WebAuthn passkey for the specified user.

Parameters

NameTypeDescription
usernameStringThe user identifier
displayNameStringDisplay name shown during passkey registration

Returns

TSWebAuthnResult—contains result.

Example

final result = await auth.registerWebAuthn('username', 'Display Name');

authenticateWebAuthn

authenticateWebAuthn(username): Future<TSWebAuthnResult>

Authenticates a user using their registered WebAuthn passkey.

Parameters

NameTypeDescription
usernameStringThe user identifier

Returns

TSWebAuthnResult—contains result.

Example

final result = await auth.authenticateWebAuthn('username');

signWebauthnTransaction

signWebauthnTransaction(username): Future<TSWebAuthnResult>

Signs a transaction using the user's WebAuthn credential.

Parameters

NameTypeDescription
usernameStringThe user identifier

Returns

TSWebAuthnResult—contains result.

Example

final result = await auth.signWebauthnTransaction('username');

approvalWebAuthn

approvalWebAuthn(approvalData, username, options): Future<TSWebAuthnResult>

Performs WebAuthn approval with custom approval data.

Parameters

NameTypeDescription
approvalDataMap<String, String>Key-value pairs describing the operation to approve
usernameStringThe user identifier
optionsList<String>Additional options for the approval

Returns

TSWebAuthnResult—contains result.

Example

final approvalData = {'transaction': 'transfer', 'amount': '100'};
final options = <String>['option1', 'option2'];

final result = await auth.approvalWebAuthn(approvalData, 'username', options);

approvalWebAuthnWithData

approvalWebAuthnWithData(authData, options): Future<TSWebAuthnResult>

Performs WebAuthn approval using raw authentication data.

Parameters

NameTypeDescription
authDataTSWebAuthnAuthenticationDataPre-obtained WebAuthn authentication data
optionsList<String>Additional options for the approval

Returns

TSWebAuthnResult—contains result.

Example

final authData = TSWebAuthnAuthenticationData(data: {
  'webauthnSessionId': 'session-id',
  'credentialRequestOptions': {}
});

final result = await auth.approvalWebAuthnWithData(authData, options);

registerTOTP

registerTOTP(uri, securityType): Future<TSTOTPRegistrationCompletion>

Registers a TOTP authenticator from a otpauth:// URI.

Parameters

NameTypeDescription
uriStringThe TOTP provisioning URI (e.g., otpauth://totp/...)
securityTypeTSTOTPSecurityType.biometric requires biometric authentication to generate codes; .none has no additional security

Returns

TSTOTPRegistrationCompletion—contains issuer, label, and uuid.

Example

final result = await auth.registerTOTP(
  'otpauth://totp/Example:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example',
  TSTOTPSecurityType.biometric
);

generateTOTPCode

generateTOTPCode(uuid): Future<TSTOTPGenerateCodeCompletion>

Generates a TOTP code for standard time-based authentication.

Parameters

NameTypeDescription
uuidStringThe TOTP identifier returned from registerTOTP

Returns

TSTOTPGenerateCodeCompletion—contains the generated code.

Example

final result = await auth.generateTOTPCode('your-totp-uuid');

generateTOTPCodeWithChallenge

generateTOTPCodeWithChallenge(uuid, challenge): Future<TSTOTPGenerateCodeCompletion>

Generates a TOTP code bound to a challenge for transaction signing or enhanced security scenarios.

Parameters

NameTypeDescription
uuidStringThe TOTP identifier returned from registerTOTP
challengeStringA server-generated challenge string

Returns

TSTOTPGenerateCodeCompletion—contains the generated code.

Example

final result = await auth.generateTOTPCodeWithChallenge('your-totp-uuid', 'challenge-string');

signWithDeviceKey

signWithDeviceKey(challenge): Future<TSSignChallengeResult>

Signs a challenge using the device key for secure authentication and transaction validation.

Parameters

NameTypeDescription
challengeStringThe challenge to sign

Returns

TSSignChallengeResult—contains the signature.

Example

final result = await auth.signWithDeviceKey('challenge-to-sign');

getDeviceInfo

getDeviceInfo(): Future<DeviceInfo>

Retrieves the device's public key information.

Returns

DeviceInfo—contains publicKeyId and publicKey.

Example

final deviceInfo = await auth.getDeviceInfo();

setLoggingEnabled

setLoggingEnabled(enabled): Future<bool>

Enables or disables SDK logging for debugging.

Parameters

NameTypeDescription
enabledbooltrue to enable logging, false to disable

Returns

booltrue if the configuration was applied successfully.

Example

await auth.setLoggingEnabled(true);