Actors

The following actors are available globally.

  • Default implementation that generates and persists a device identifier. Implements DeviceIdentifier protocol to provide a unique identifier for the device. Example usage:

    let deviceId = DefaultDeviceIdentifier()
    let identifier = try await deviceId.id
    
    // In case of migration from the FR SDK when using a custom Keychain Access Group use the following
    
    
    func setupDeviceIdentifierWithMigration() async throws -> String {
        // If your legacy FRAuth SDK used a custom keychain access group,
        // specify it here to enable migration
        let configuration = DeviceIdentifierConfiguration(
            keySize: DeviceIdentifierConfiguration.default.keySize,
            keychainAccount: DeviceIdentifierConfiguration.default.keychainAccount,
            useEncryption: DeviceIdentifierConfiguration.default.useEncryption,
            legacyKeychainAccessGroup: "com.test" // Set Legacy Keychain Access Group
        )
    
        // Initialize with configuration
       let deviceIdentifier = try DefaultDeviceIdentifier(
            configuration: configuration,
            logger: LogManager.standard  // Optional: for debugging migration
        )
    
        // First access will trigger migration if legacy identifier exists
        let deviceId = try await deviceIdentifier.id
        print("Device ID: \(deviceId)")
    
        return deviceId
    }
    
    See more

    Declaration

    Swift

    public actor DefaultDeviceIdentifier : DeviceIdentifier, Sendable
  • A fallback device identifier that uses a UUID when key pair generation fails. It generates and persists a UUID, then computes the ID by hashing the UUID’s bytes. Example usage:

    let deviceId = UUIDDeviceIdentifier()
    let identifier = try await deviceId.id
    
    See more

    Declaration

    Swift

    public actor UUIDDeviceIdentifier : DeviceIdentifier, Sendable