FlitDocs

Identify the device

An IP address is weak evidence of who someone is: it is shared, and it changes. Flit's SDKs collect enough about a browser or a phone to recognise it again, and give you a token to send with the event.

How it works

  1. Your page or app collects

    One call to the SDK, just before the login, reset or payout. It returns a visit token.

  2. It sends the token to your server

    With the request it was already making.

  3. Your server passes it to Flit

    As visit_token on the event. A token lasts 30 minutes and only works for your application.

The key the SDK takes is your application's public one, collect_key in the answer to signing up. It is safe to ship in a page or an app; it authorises nothing.

Never stop a customer because collection failed. Wrap the call and carry on without a token. Flit still decides, with less to go on.

In a browser

npm install @agentflit/browser
import { collect } from "@agentflit/browser";

const { visitToken } = await collect({ key: "flit_pk_…" });

With no build step, import it from a CDN instead, with the version pinned: https://cdn.jsdelivr.net/npm/@agentflit/browser@0.4.0/src/index.js.

In an iOS app

A Swift package with no dependencies, for iOS 13 and later. In Xcode, choose File, then Add Package Dependencies, and enter:

https://github.com/Fraud-killer/flit-ios
import Flit

func visitToken() async -> String? {
    try? await Flit.collect(key: "flit_pk_…").token
}

Flit's name for the device is kept in the Keychain, so a phone is recognised after your app is deleted and installed again.

In an Android app

A Kotlin library with no run-time dependencies, for Android 5 and later. It is built from its repository by JitPack, so add JitPack to the repositories in settings.gradle.kts, and the library to your app:

// settings.gradle.kts, inside dependencyResolutionManagement { repositories { … } }
maven("https://jitpack.io")

// your app's build.gradle.kts
dependencies {
    implementation("com.github.Fraud-killer.flit-android:flit:0.2.0")
}

It makes a network request, so call it off the main thread.

suspend fun visitToken(context: Context): String? = withContext(Dispatchers.IO) {
    try { Flit.collect(context, "flit_pk_…").token } catch (e: FlitException) { null }
}

What your server sends for an app

The same event as always, with the token. Keep sending the user_agent your server received:

{ "id": "login_1001", "client_id": "user_42", "action": "login",
  "ip_address": "…",
  "user_agent": "okhttp/4.12.0",
  "visit_token": "…" }

An app's user agent is its networking library's, okhttp/4.12.0 or MyBank/3.1 CFNetwork/…, and a script uses the same libraries. Without a token Flit reads such a login as scripted and reports automated_credential_action. The token from the app's SDK is what tells Flit it is your app.

Ship the SDK before you send app traffic to an enforcing application. Otherwise Android logins in particular are refused as scripts.

Prove it is your app

Everything above is the app's word, and a modified copy of your app says whatever it likes. Attestation is the platform's word instead. Apple and Google will each vouch that a request came from an unmodified copy of a named app on a genuine device, and Flit checks what they say. It needs version 0.2.0 of the SDKs.

1. Tell Flit which apps are yours

PATCH /api/v1/applications/$APP/policy
curl -s -X PATCH "$FLIT/api/v1/applications/$APP/policy" \
  -H "Authorization: Bearer $KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "attestation": {
      "ios": {
        "team_id": "A1B2C3D4E5",
        "bundle_ids": [
          "com.example.bank"
        ]
      }
    }
  }'
200 Answer the fields this page talks about
{
  "data": {
    "attestation": {
      "ios": {
        "team_id": "A1B2C3D4E5",
        "bundle_ids": [
          "com.example.bank"
        ],
        "environment": "production"
      }
    }
  }
}
The whole answer
{
  "data": {
    "thresholds": {
      "block_at": 0.7,
      "review_at": 0.5,
      "challenge_at": 0.45
    },
    "weights": {},
    "rules": {
      "block": [],
      "review": [],
      "challenge": [
        {
          "subject": "client_id",
          "pattern": "user_501",
          "reason": "Reported a lost phone"
        }
      ],
      "allow": []
    },
    "disabled_rules": [],
    "shadow_rules": [],
    "live_rules": [],
    "challenge_method": "otp",
    "latency_budget_ms": 3000,
    "outflow_limits": {
      "currency": "NGN",
      "per_initiator": {
        "1h": 5000000,
        "24h": 20000000
      },
      "per_application": {
        "24h": 200000000
      },
      "fail": "block"
    },
    "beneficiary_control": {
      "enabled": true,
      "cooling_hours": 72,
      "fail": "block"
    },
    "account_limits": {
      "single_transaction": "USD 10,000.00",
      "levels": {
        "level_one": {
          "maximum_single_debit": "USD 500.00",
          "maximum_single_credit": "USD 2,000.00",
          "maximum_cumulative_balance": "USD 10,000.00",
          "maximum_daily_cumulative_debit": "USD 1,000.00"
        },
        "level_two": {
          "maximum_single_debit": "NGN 10,000.00",
          "maximum_single_credit": "NGN 100,000.00",
          "maximum_cumulative_balance": "NGN 500,000.00",
          "maximum_daily_cumulative_debit": "NGN 100,000.00"
        },
        "level_three": {
          "maximum_single_debit": "NGN 10,000,000.00",
          "maximum_single_credit": null,
          "maximum_cumulative_balance": null,
          "maximum_daily_cumulative_debit": "NGN 100,000,000.00"
        },
        "merchant_starter": {
          "maximum_single_debit": "NGN 1,500,000.00",
          "maximum_single_credit": "NGN 2,000,000.00",
          "maximum_cumulative_balance": "NGN 10,000,000.00",
          "maximum_daily_cumulative_debit": "NGN 2,000,000.00"
        },
        "merchant_standard": {
          "maximum_single_debit": "NGN 10,000,000.00",
          "maximum_single_credit": "NGN 10,000,000.00",
          "maximum_cumulative_balance": "NGN 250,000,000.00",
          "maximum_daily_cumulative_debit": "NGN 25,000,000.00"
        },
        "merchant_enterprise": {
          "maximum_single_debit": "NGN 25,000,000.00",
          "maximum_single_credit": null,
          "maximum_cumulative_balance": null,
          "maximum_daily_cumulative_debit": "NGN 300,000,000.00"
        }
      },
      "currencies": {}
    },
    "liveness_factors": [
      "account_takeover_risk",
      "beneficiary_unverified",
      "credential_reset_storm",
      "impossible_travel_detected",
      "maximum_daily_cumulative_debit_exceeded",
      "maximum_single_debit_exceeded",
      "new_device_country",
      "new_withdrawal_address",
      "reset_then_login",
      "unknown_beneficiary",
      "unusual_debit_amount"
    ],
    "liveness_enabled": true,
    "enforcement": "enforcing",
    "webhook": null,
    "decision_hook": null,
    "liveness": {
      "provider": "sumsub",
      "settings": {
        "level_name": "liveness-only"
      },
      "credentials_configured": [
        "app_token",
        "secret_key"
      ],
      "ready": true
    },
    "attestation": {
      "ios": {
        "team_id": "A1B2C3D4E5",
        "bundle_ids": [
          "com.example.bank"
        ],
        "environment": "production"
      }
    },
    "passkeys": null,
    "effective": {
      "thresholds": {
        "block_at": 0.7,
        "review_at": 0.5,
        "challenge_at": 0.45
      },
      "enforcing": true
    },
    "rule_findings": [],
    "organization": null
  },
  "errors": []
}

For iOS, that is your Apple team id and your bundle ids. Add "environment": "development" on your test application to accept builds run from Xcode; a live application should not. For Android, your package names and the JSON key of a Google service account that may read Play Integrity verdicts:

{ "attestation": { "android": {
    "package_names": ["com.example.bank"],
    "service_account": { "client_email": "…", "private_key": "…" } } } }

The service account must be in the Google Cloud project linked to your app in Play Console, with the Play Integrity API enabled. Flit keeps the key encrypted and never shows it again. Turning attestation on is a tightening, so an application key may do it; only a signed-in owner may switch it off, add an app, or accept development builds.

2. Ask for it in the app

On iOS, add the App Attest capability to your app in Xcode, then:

let visit = try await Flit.collect(key: "flit_pk_…", attest: true)

On Android, add Flit's Play Integrity library beside the SDK, make one provider for the life of the app, and pass it:

// build.gradle.kts
implementation("com.github.Fraud-killer.flit-android:flit:0.2.0")
implementation("com.github.Fraud-killer.flit-android:flit-play-integrity:0.2.0")

// once, at start, off the main thread
val playIntegrity = PlayIntegrity(context, cloudProjectNumber = 123456789012)
playIntegrity.warmUp()

// each collection
Flit.collect(context, "flit_pk_…", integrity = playIntegrity)

Nothing changes on your server: it sends the visit token as before. Collection never fails because attestation did. A phone that cannot produce a proof still gets a token, and Flit records that it came without one.

3. Watch, then count

FindingWhat it means
app_attestation_failedA proof was sent and did not hold: forged, made for another app, or replayed. A genuine app does not produce one. context.reason says which check failed.
app_not_attestedThe visit carried no proof. An old phone, a phone without Play services, or the platform out of reach will do that; so will a copy of your app with the check removed. Weak alone.
app_not_recognizedAndroid: Google does not recognise the build as one Play distributed. A sideloaded or repackaged copy.
device_integrity_unverifiedAndroid: Google would not vouch for the device. Rooted, an emulator, or a custom ROM.

These start recorded and not counted. They appear on decisions as shadow findings and change no score until you make the rule count: in the console under Rules, On trial, or by adding AppAttestationRule to live_rules. Run real traffic from your released apps first and check that genuine customers come back clean. While you are setting up, visit.attestation in the app says what Flit made of the proof (verified, failed, absent, unchecked); use it for your logs and decide nothing on it in the app.

What has and has not been run. The App Attest checks pass against attestations Apple really issued. The Play Integrity checks are written to Google's documented verdicts and have not been run against Google, and neither SDK's attestation has run on a phone. That is the reason these findings start recorded only.

What you gain

  • The identity part of the answer gains a device rung, and coverage rises.
  • Findings about one origin follow the device instead of the address, so an attacker changing address is still one origin.
  • new_login_device can be reported: somewhere new.
  • From a browser, Flit reports one that contradicts itself: automation_markers, platform_mismatch, spoofed_timezone.
  • From an app, what the SDK noticed about the phone: jailbroken_device, emulator, hooking_framework, developer_tools, cloned_app, remote_control while the screen is being captured.

What the SDKs send

Coarse values and hashes, and nothing that names the owner. None of them asks the customer for a permission.

FromWhat
A browserHashes of how it draws (canvas, WebGL, audio, fonts), its screen, languages, time zone and platform.
An appThe hardware model, OS version, screen, processor count, memory, languages and time zone, and an install identifier.

The install identifier is the platform's own (Apple's vendor identifier, Android's id) hashed together with your app's id on the phone. Flit cannot turn it back, and cannot link it to another app. The SDKs do not read the advertising identifier, contacts, photos, location or the device's name.

What a phone's own report is worth

The integrity findings are your app's observations of the phone it is running on. A rooted phone or an emulator reports itself, which is most of what you will meet. A modified copy of your app can report whatever it likes, and so can a script that calls Flit's collection endpoint directly. Flit weighs these with everything else; they are evidence, not proof.

What proves a request came from your unmodified app on a genuine device is the platform's attestation: Apple's App Attest and Google's Play Integrity. Flit checks both: prove it is your app.