Skip to main content

Authentication

Models and methods for managing device authentication mechanisms (PIN and biometrics).

TFAuthenticationMechanism

Represents a supported authentication mechanism.

public enum TFAuthenticationMechanism: String, Codable {
case pin
case biometrics
}

TFAuthentication

Authentication credential passed to addAuthentication in an operation decision flow. Mirrors the iOS Authentication enum with associated values.

public enum Authentication {
case biometric(context: LAContext)
case pin(value: String)
}

TFAuthenticationResponse

Returned upon a successful authentication. The refreshToken can be stored to restore session without re-authenticating with a PIN.

public struct TFAuthenticationResponse {
public let refreshToken: String

public init(refreshToken: String)
}

TFAuthenticationPINRequirements

Defines the allowed PIN length range and validates a PIN against it.

public struct TFAuthenticationPINRequirements: Codable {
public let minLength: Int
public let maxLength: Int

/// Returns an error if the PIN does not satisfy the requirements, otherwise nil.
public func validate(pin: String) -> Error?

public init(minLength: Int, maxLength: Int)
}