# Antifraud Module

<WebSDK2 />

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](doc: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). |

## See also

* [Module Patterns → backend-process](doc:web-sdk-2-module-patterns#3-backend-process-modules)
* [Individual Modules](doc:web-sdk-2-individual-modules)
