> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/propiedades/antispoof.md).

# antispoof

## Details

**Attribute:** `antispoof`

**Type:** `boolean`

**Default value:** `false`

## Morphology

```typescript
selphi.antispoof = true;
```

## Description

Activate anti-fraud detection in `facephi-selphi-widget`. If enabled, suspicious video injection behaviors interrupt capture and IAD payloads are generated in `extractionFinish`.

### Considerations

It can block debugging tools such as the browser console. It is advisable to set its value with an environment variable or before deployment to production.

If anti-spoofing is enabled, the use of `externalCamera` will be ignored.

In integrations within a **iframe** it is necessary to activate focus within the container:

```typescript
const iframe = document.getElementById('my-iframe') as HTMLIFrameElement;
iframe.addEventListener('load', () => {
  iframe.focus();
});
```

### Additional information

**Compatibility:** Replaces `antispoofEnabled` in previous versions of the SDK Web.

**Behaviors considered spoofing:**

* Focusing outside the window that contains the SDK.
* Opening the browser development tools.
* Opening overlapping modals on the web (print, save, etc.).
* Use of virtual cameras (OBS, emulators, browser-based injection).

**Additional Integration:** the encrypted payload is obtained in `extractionFinish` inside `encryptedLivenessRaw`. It must be sent to the server and from there to the IAD endpoint of Identity API.

Send as `.bin` (recommended):

```typescript
function handleExtractionFinish(event: CustomEvent) {
  const result = event.detail.detail;
  const blob = result.encryptedLivenessRaw;
  const link = document.createElement('a');
  link.href = URL.createObjectURL(blob);
  link.download = 'archivo.bin';
  link.click();
}
```

Via direct fetch (not recommended):

```typescript
function handleExtractionFinish(event: CustomEvent) {
  const result = event.detail.detail;
  fetch('...', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/octet-stream',
      'x-api-key': '...',
    },
    body: result.encryptedLivenessRaw,
  });
}
```

***

## Example

```jsx
<facephi-selphi-widget
    antispoof={true}

    onExtractionFinish={(event) => {
      const livenessRaw = event.detail.detail.encryptedLivenessRaw;
      testLiveness(livenessRaw);
    }}
/>
```
