Skip to main content

Errors

All errors produced by the TrustFactor SDK are wrapped in TrustFactorError. Match on the domain property to identify the error category and specific code.

TrustFactorError

The top-level SDK error type.

public struct TrustFactorError: Error {
public enum Domain: Hashable {
case client(code: ClientDomainCode)
case authentication(code: AuthenticationDomainCode)
case network(code: NetworkDomainCode)
case operationDecision(code: OperationDecisionDomainCode)
case profileAction(code: ProfileActionDomainCode)
case unknown
}

public let domain: Domain
public let parameters: [String: Any]

public init(domain: Domain, parameters: [String: Any] = [:])
}

ClientDomainCode

General SDK-state errors.

public enum TrustFactorError.ClientDomainCode: Hashable {
case notStarted
case deviceNotRegistered
case alreadyRegistered
case notAuthenticated
case needsUpdate
case serviceNotAvailable
case notAuthorized
case permanentlyLocked
case needsAuthentication
case deviceNotReady
case couldNotSyncProfiles
case apnsTokenNotSet
case applicationNotFound
case profileNotFound
case needsToAcceptTermsAndConditions
case integrationAppNotSuported
case invalidLanguage
case doesNotMatchRequirements
}

AuthenticationDomainCode

Errors related to PIN or biometric authentication.

public enum TrustFactorError.AuthenticationDomainCode: Hashable {
case wrongCredential
case cooldown(until: Date)
case biometricTokenExpired
case setup_newPinMatchesOld
case PINDoesNotMatchRequirements
case biometricAuthenticationNotEnabled
}

NetworkDomainCode

Errors related to network connectivity.

public enum TrustFactorError.NetworkDomainCode: Hashable {
case couldNotReachServices
}

OperationDecisionDomainCode

Errors that occur when approving or rejecting an operation.

public enum TrustFactorError.OperationDecisionDomainCode: Hashable {
case requireBiometricAuthentication
case requirePINAuthentication
case alreadyDecided
case cantDecideWithoutGettingDetails
}

ProfileActionDomainCode

Errors related to profile association, dissociation, sharing, or recovery.

public enum TrustFactorError.ProfileActionDomainCode: Hashable {
case profileNotReady
case forgedProfile
case profileNotAssociatedToThisDevice
case couldNotCommunicateWithApplication(appName: String?)
case profileNeedsRevalidation
// Recovery
case invalidRecoveryCode
case recoveryCodeAlreadyUsed
// Association
case invalidAssociationCode
case alreadyAssociated
case associationCodeAlreadyUsed
case associationCodeExpired
case profileExceededMaxDevices
// Share
case expiredShareToken
}