Identity Integration in IOS
#
DescriptionTrust is a platform that allows building trust and security between people and technology.
TrustDeviceInfo allows you to obtain a unique universal ID for each device from a set of characteristics of this device. It also allows the monitoring of device status changes, to have knowledge of the device status at all times.
#
ImplementationAdd in your podfile:
And execute:
#
Initialize#
Generate a new TrustID:AccessGroup: To generate a new accessGroup you need to activate your keychain sharing capability in Signing & Capabilities, you must also be part of an Apple development group to access to its identifier to generate your access group.
Team ID: Found it in https://developer.apple.com/
- accessGroup structure: "teamID.keychainName.id". (Team ID can be found here)
- accessGroup example: "example.access.group"
- clientID and clientSecret are generated in backend, so you must request access codes to the provider.
#
Methods#
Enable TrustDeviceInfoEnables TrustDeviceInfo device information access
#
Get access tokenAsks for credentials to access Trust Identification services
#
Get Trust IDReturns the device Trust ID
.prod
or .test
)#
Set Current environment (Sets the current working environment for TrustDeviceInfo
#
Set ServiceName and AccessGroup for Keychain AccessSets the ServiceName and AccessGroup to safely save and fetch values from the Keychain
#
Register Identity- Consider call replacing with the user identity DNI. Example: Identify.shared.setAppState(dni: "11.111.111-1")
- TrustDeviceInfo.shared.sendDeviceInfo(identityInfo: userIdentity)
- userIdentity must need to be: IdentityInfoDataSource protocol type
#
Set App StateSets the app identification state. You should call this method when your app finishes the current user session checking, if there's an active session you should send the dni of current user as parameter
If no user logged in you should use
#
Send Device InfoSends the device hardware information to Trust Identification services and optionally sends the identity of current user (if any)
otherwise you can provide only the default data by calling
#
Delete Trust IDRemoves the device generated TrustID
#
Implementation Example#
PermissionsAs mentioned above, we must activate the keychain sharing capability and set our new "Keychain Group"
NOTE: Remember your keychain groups to share information between apps with the same team ID.