Skip to main content

Profile Share

To use already associated profiles on multiple devices you can share them.

Create a sharing token (receiving device)

First, the device that is going to receive the Application Profiles needs to present a QRCode that the sharing device is going to scan.

Client requirements

trustfactorClient.createApplicationProfilesShareReceivingToken() { result, correlationId in
switch result {
case .success(let qrCodeImageData): // Data
let image = UIImage(data: qrCodeImageData)

case .failure(let error):
// handle errors
}
}

Share profiles (origin device)

The sharing device scans the QRCode presented by the receiving device and sends the Application Profiles

Client requirements

/// to: value from the scanned QRCode
trustfactorClient.shareProfiles(to: <String>, profiles: [<TFApplicationProfile.RawIdentifier>]) { result, correlationId in
switch result {
case .success:
// handle success

case .failure(let error):
// handle errors
}
}

Associate shared profiles (receiving device)

Client requirements

// retrieve from notification payload
var userInfo: [AnyHashable: Any] = .....

// get push notification type and content
guard case let .receivedShareApplicationProfiles(payload, error) = try trustfactorClient.getPushNotificationContent(for: userInfo) else {
print("Not shared Profiles notification")
}

// make sure payload is set and no errors occured
guard let payload, error == nil else {
// handle error
}

trustfactorClient.associateSharedApplicationProfiles(from: payload) { result, correlationId in
switch result {
case .success(let associationResult):
// handle result

case .failure(let error):
// handle errors
}
}