# Development

A development setup is a complete XS4 Face site in the acceptance environment,
built from the same parts as a customer installation. It lets you test the
whole journey your integration is responsible for, from inviting a user to the
user ID reaching your MMS when their face is recognised.

## What you can test

With the setup below you can test, end to end:

1. A user being invited to enroll when your MMS adds them
2. The user enrolling — accepting the terms of service, submitting an image and
   giving consent
3. The enrollment image being processed and made available on the site's
   server
4. The user's face being recognised by an XS4 Face device
5. The user ID being passed to your MMS through the GT7 linked to that device
6. The user being removed, after which they are no longer recognised

```mermaid {align="center" zoom="true"}
sequenceDiagram
    participant MMS
    participant Cloud as XS4 Face Cloud
    participant Server as XS4 Face Server
    participant Device as XS4 Face Device
    participant GT7
    MMS->>Cloud: Add user (Users API)
    Cloud-->>Cloud: User enrolls (Enrollment App or your app)
    Cloud->>Server: Enrollment image delivered
    Device->>Server: Face presented
    Server-->>Device: Recognised user ID
    Device->>GT7: User ID
    GT7->>MMS: Access request for user ID
    MMS->>Cloud: Remove user (Users API)
    Cloud->>Server: User removed
```

## What you need

| Component | Purpose | Options |
| --- | --- | --- |
| XS4 Face site | Holds the users, servers and devices for one customer | Created in the XS4 Face Console |
| XS4 Face Server | Recognises enrolled users on site | Physical machine or virtual machine |
| XS4 Face Device | Captures a face and sends it to the server | Real device, or a simulated device from the [XS4Face CLI](/XS4Face-CLI/_index) |
| GT7 | Passes the recognised user ID to your MMS | Real GT7 terminal |
| Your MMS | Adds and removes users, and grants access | Your development instance |

The server, devices and GT7 must share a wired network. See the network
requirements in [System requirements](https://support.saltosystems.com/xs4face/user-guide/systems-admin/system-requirements/).

## Build the setup

### 1. Create a site

Register as a partner and create a site in the acceptance console by following
[Getting Started](_getting_started) steps 1 to 7.

> [!note]
> The XS4Face CLI cannot create sites. Once the site exists, add it to the CLI
> with `xs4face config site add` — see
> [Getting started with the CLI](/XS4Face-CLI/_index#3-add-a-site).

### 2. Add a server

The XS4 Face Server can run on physical hardware or in a virtual machine. Check
that the machine meets the
[system requirements](https://support.saltosystems.com/xs4face/user-guide/systems-admin/system-requirements/)
before you start — in particular an **AVX2** capable x64 processor, a
**TPM 2.0**, 32 GB of memory and a wired network connection with a reserved IP
address.

In the XS4 Face Console open **Servers**, click **Add Server** and follow the
wizard. The
[server installation guide](https://support.saltosystems.com/xs4face/user-guide/systems-admin/server-installation/)
covers both the express and advanced installation.

- **Physical machine** — boot the machine from a Server Installation USB.
- **Virtual machine** — download the
  [XS4 Face Server Installer ISO](https://installer.global.xs4face.app/v1/xs4face-server-installer.iso)
  and boot the virtual machine from it. The
  [server virtualisation guide](https://support.saltosystems.com/xs4face/user-guide/systems-admin/server-virtualisation/)
  walks through a Windows Hyper-V setup, including the TPM and Secure Boot
  settings the virtual machine needs.

The server is ready when it shows as **green** in the console.

### 3. Enable the GT7 feature

Enable the **GT7** feature and note its **Feature ID**, as described in
[Getting Started](_getting_started#8-enable-the-gt7-feature). The Feature ID is
used in every [Users API](/MMS/_api) call for the site.

### 4. Commission each GT7

Open the **GT7** feature settings (the cog icon) and click **Add Device** once
for each GT7. Each new entry shows an **Access Token**, and the panel shows the
server's **IP Address**. Configure the GT7 with the server IP address and its
access token to commission it to the server.

Once commissioned, each GT7 is available as a **control point** that XS4 Face
devices can be linked to.

### 5. Commission XS4 Face devices

Commission at least one XS4 Face device to the server. You can use real devices,
simulated devices or both.

- **Real device** — in the console open **Devices**, click **Add Device** and
  show the QR code to the device. Follow
  [How to commission an XS4 Face Device](https://support.saltosystems.com/xs4face/user-guide/installer/device-commissioning/).
- **Simulated device** — create and commission a device from the command line,
  following [Add a simulated device](/XS4Face-CLI/_index#4-add-a-simulated-device).
  A simulated device sends a stored image in place of a live face, so tests
  give the same result every time and can be automated.

### 6. Link each XS4 Face device to a GT7

Each XS4 Face device must be linked to the GT7 at the same door, so that the
user ID of a recognised face is passed to the right GT7.

- **Real device** — select the GT7 as the **Control Point** in the **Add
  Device** dialog before you click **Pair**.
- **Simulated device**, or a real device paired without a control point —
  select the device on the **Devices** page and add the GT7 as its control
  point.

## Run the tests

### Invite and enroll a user

Add a user with the [Users API](/MMS/_api), as shown in
[Getting Started](_getting_started#10-enable-a-user-for-face-recognition). The
user starts in the `PENDING_TOS` state.

- **Level 1** — the user receives an email invitation and enrolls with the
  Salto Enrollment App.
- **Level 2** — your app takes the user through enrollment with the
  [Enrollment API](/App/_api), following
  [Enrollment Design](/App/_design).

Poll `GET /features/{featureId}/users/{userId}` to follow the user through the
states in the [User Consent Lifecycle](/MMS/_user_lifecycle). When the user
reaches `ACTIVE`, their enrollment image has been accepted and is delivered to
the site's server.

### Recognise the user

Present the user's face to the device:

- **Real device** — the user stands in front of the XS4 Face device.
- **Simulated device** — send an image of the user with
  [`xs4face mock device request`](/XS4Face-CLI/_index#5-send-an-image). Using
  the same image the user enrolled with gives a predictable match.

Check that the GT7 linked to the device sends an access request to your MMS
with the user's ID, and that your MMS grants access. Access requests are also
shown in the XS4 Face Console.

### Remove the user

Remove the user with `DELETE /features/{featureId}/users/{userId}` in the
[Users API](/MMS/_api), then present their face again. The user should no longer
be recognised, and no access request should reach your MMS.

To test the user withdrawing consent instead, see
[Revocation and removal](/App/_design#revocation-and-removal).

## Next steps

When your integration passes these tests, request approval for production
access — see the [Approval Process](_approval).

