Skip to main content

TrustFactor Client

A client is an instance of TrustFactor that represents the context of the application. A TrustFactor client provides all the APIs to interact with the Device, its functions and its properties.

Create a client

To start using the SDK you need to create a client.

let configuration = TFClientConfiguration(
host: TFClientConfiguration.HostApp(
id: "", // your app ID
version: "", // marketing version of the host app
appGroup: "group.trustfactor", // Make sure you create a group specific to TrustFactor in order to avoid conflicts for keychain and UserDefaults
locale: Locale.current // Used to infer device language
),
api: TFClientConfiguration.APIConfig(
primaryEndpoint: "<>",
primaryKey: "<>",
secondaryEndpoint: "<>",
secondaryKey: "<>"
)
)

TrustFactor.getClient(configuration: configuration) { result, correlationId in
switch result {
case .failure(let error):
fatalError()

case .success(let client):
break; // handle the client instance
}
}