# Antifraud Module Guide

This guide is specific to Web SDK 2.0. If you are still using 1.x, you can find documentation [here](https://developer.incode.com/docs/web-sdk-reference). Contact your Incode Representative for upgrade information and check if you are a candidate for this upgrade.

The Antifraud module collects device, browser, and behavioral signals in the background and submits them to Incode's antifraud engine. Fire-and-forget — completes regardless of API outcome so the verification flow is never blocked.

Follows the [backend-process pattern](https://developer.incode.com/docs/web-sdk-2-module-patterns#3-backend-process-modules). See the patterns page for the shared lifecycle.

## Tag

`<incode-antifraud>` is a standard Web Component. Importing the UI subpath registers the custom element.

```ts
import '@incodetech/web/antifraud';
import '@incodetech/web/antifraud/styles.css';
```

The component is essentially invisible — it runs the check and emits `onFinish`. You can mount it during transitions while showing your own loading UI.

## Properties

| Property     | Type               | Required | Description                                                 |
|--------------|--------------------|----------|-------------------------------------------------------------|
| `config`    | `AntifraudConfig`  | ❌      | No options — type is `Record<string, never>`                |
| `onFinish`  | `() => void`       | ❌      | Called when the check completes                             |
| `onError`   | `(error: string) => void` | ❌  | Called on a fatal error (rare — module swallows API errors by design) |

## Configuration

The module takes no configuration:

```typescript
type AntifraudConfig = Record<string, never>;
```

## State machine

`AntifraudState` is minimal — a discriminated union over `status`:

| Status      | Description                                          |
|-------------|------------------------------------------------------|
| `idle`      | Initial state.                                      |
| `processing`| Collecting signals and submitting to the backend.    |
| `finished`  | Terminal — check is done (success or silent failure).|
