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
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
}
}
HostApp hostApp = new HostApp(appId: <String>, appVersion: <String>, deviceLanguage: <Locale>);
APIConfig api = new APIConfig(primaryEndpoint: <String>, primaryKey: <String>, secondaryEndpoint: <String>, secondaryKey: <String>);
TFConfiguration configuration = new TFConfiguration(hostApp: <HostApp>, api: <APIConfig>);
TrustFactor.getClient(applicationContext: <Context>, configuration: <TFConfiguration>, new Result<TrustFactor, Error>() {
@Override
public void onSuccess(TrustFactor client, String correlationId) {
// handle the client instance
}
@Override
public void onFailure(Error error, String correlationId) {
// handle errors
}
});