Skip to main content

Applications & Profiles

Models and methods for managing application profiles — including association, dissociation, sharing, and recovery.

TFApplication

Represents a registered application.

public struct TFApplication {
public typealias ID = Identifier<Self, String>

public let id: ID
public let name: String
public let logo: URL?
public let version: String
public let isFraudReportEnabled: Bool
}

TFApplicationProfile

Represents a user profile associated with an application.

public struct TFApplicationProfile {
public struct ID: Hashable {
public let applicationProfileId: String
public let applicationID: String

public init(applicationProfileId: String, applicationID: String)
}

public let id: ID
public let name: String
public internal(set) var state: State?
public internal(set) var associationDate: Date?
public internal(set) var taints: [Taint]

public init(
id: ID,
name: String,
publicKey: String,
associationDate: Date? = nil,
taints: [Taint] = []
)
}

TFApplicationProfile.State

Reflects the current health state of a profile.

public enum TFApplicationProfile.State {
case corrupted
case pendingPropagation
case removed
}

TFApplicationProfile.Taint

A flag indicating that the profile requires attention.

public enum TFApplicationProfile.Taint: Hashable, Codable {
case needsRevalidation(until: Date)
}

TFApplicationProfiles

A collection of application profiles with their associated applications.

public struct TFApplicationProfiles {
public let profiles: [TFApplicationProfile]
public let applications: [TFApplication]

public init(profiles: [TFApplicationProfile], applications: [TFApplication])

/// Returns the application associated with the given profile, if available.
public func applicationForProfile(_ profile: TFApplicationProfile) -> TFApplication?
}

TFApplicationProfileDevice

Represents a device associated with an application profile.

public struct TFApplicationProfileDevice: Codable {
public typealias KeyIdentifier = Identifier<Self, String>

public var id: KeyIdentifier { key }
public let key: KeyIdentifier
public let name: String
public let manufacturer: String
public let model: String
public let operatingSystem: String
public let operatingSystemVersion: String
public let marketingName: String?
public internal(set) var associationDate: Date?
public internal(set) var isLocked: Bool?
public internal(set) var maskedDeviceIDSHA: String?
}

TFApplicationProfileDevices

Groups all devices associated with a profile into current and others.

public struct TFApplicationProfileDevices {
public let profileID: TFApplicationProfile.ID
public let currentDevice: TFApplicationProfileDevice
public let otherDevices: [TFApplicationProfileDevice]

public init(
profileID: TFApplicationProfile.ID,
currentDevice: TFApplicationProfileDevice,
otherDevices: [TFApplicationProfileDevice]
)
}

TFProfilesAssociationResult

The result of a profile association or restoration attempt.

public struct TFProfilesAssociationResult {
public struct NotAssociatedProfile {
public let profile: TFApplicationProfile
public let errors: [Error]
}

public let applications: [TFApplication]
public let associatedProfiles: [TFApplicationProfile]
public let notAssociatedProfiles: [NotAssociatedProfile]

public init(
applications: [TFApplication],
associatedProfiles: [TFApplicationProfile],
notAssociatedProfiles: [NotAssociatedProfile]
)
}

ProfilesDissociationResult

The result of a profile dissociation attempt.

public struct ProfilesDissociationResult {
public struct NotDissociatedProfile {
public let profileID: TFApplicationProfile.ID
public let errors: [Error]
}

public var dissociatedProfilesID: [TFApplicationProfile.ID]
public var notDissociatedProfiles: [NotDissociatedProfile]

public init(
dissociatedProfilesID: [TFApplicationProfile.ID],
notDissociatedProfiles: [NotDissociatedProfile]
)
}

ProfileAssociationMethod

Describes the method used to associate a new profile.

public enum TrustFactor.ProfileAssociationMethod {
case deeplink(URL)
case code(String)
}