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.
- iOS (Swift)
- Android (Java)
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
keychainAccessGroup: "<teamID>.keychainAccessGroup",
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
}
}
Context applicationContext = getApplicationContext();
TFClientConfiguration configuration = new TFClientConfiguration(
new TFClientConfiguration.HostApp(
"<appId>", // your app ID
"<appVersion>", // marketing version of the host app
Locale.getDefault() // used to infer device language
),
new TFClientConfiguration.APIConfig(
"<primaryEndpoint>",
"<primaryKey>",
"<secondaryEndpoint>",
"<secondaryKey>"
)
);
TrustFactor.getClient(applicationContext, configuration, (result) -> result.fold(
(TrustFactor client, String correlationId) -> {
// handle success
},
(Error error, String correlationId) -> {
// handle error
}
));