> For the complete documentation index, see [llms.txt](https://docs.caf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caf.io/caf-sdk/caf-sdk-pt-br/android/standalone-modules/cafsmartauth/builder.md).

# Compilando o SDK

## Criando uma instância do SDK CafSmartAuth

Para criar uma `CafSmartAuth` instância, você precisa usar a `CafBuilder` classe. Esta classe fornece um conjunto de métodos para configurar a instância do SDK.

### Propriedades do Builder

| Propriedade   | Tipo     | Descrição                              | Obrigatório |
| ------------- | -------- | -------------------------------------- | :---------: |
| `mobileToken` | String   | Token móvel fornecido pela plataforma. |      ✅      |
| `context`     | Contexto | Contexto da aplicação.                 |      ✅      |

### Métodos do Builder

| Método                         | Tipo                         | Descrição                                                                                       | Obrigatório |
| ------------------------------ | ---------------------------- | ----------------------------------------------------------------------------------------------- | :---------: |
| `setStage`                     | CafStage                     | Define o estágio do ambiente (ex.: PROD, BETA). O padrão é PROD.                                |      ❌      |
| `setEmailUrl`                  | String                       | Define uma URL de autenticação por e-mail. Deve usar o protocolo HTTPS.                         |      ❌      |
| `setPhoneUrl`                  | String                       | Define uma URL de autenticação por telefone. Deve usar o protocolo HTTPS.                       |      ❌      |
| `setFaceAuthenticatorSettings` | CafFaceAuthenticatorSettings | Define as configurações de autenticação de prova de vida facial.                                |      ❌      |
| `setThemeConfigurator`         | CafTheme                     | Define a configuração de tema para o SDK. Personalize a aparência para os modos claro e escuro. |      ❌      |

### Configuração do Tema

Para personalizar a aparência do SDK, use os métodos do configurador de tema. Duas estruturas são usadas para a configuração do tema: `CafThemeConfigurator` e `CafTheme`.

#### CafThemeConfigurator

```kotlin
data class CafThemeConfigurator(
    val lightTheme: CafTheme = CafTheme(),
    val darkTheme: CafTheme = CafTheme(),
)
```

Esta estrutura permite definir temas separados para os modos claro e escuro. Cada tema é definido por uma estrutura CafTheme.

```kotlin
data class CafTheme(
    val backgroundColor: String = "#FFFFFF",
    val textColor: String = "#FF000000",
    val linkColor: String = "#004AF7",
    val boxBorderColor: String = "#004AF7",
    val boxBackgroundColor: String = "#0A004AF7",
    val boxTextColor: String = "#004AF7",
    val progressColor: String = "#004AF7",
)
```

Esta estrutura define vários atributos de aparência para o SDK. Você pode personalizar cores de fundos, texto, links, bordas e indicadores de progresso fornecendo valores de string hexadecimais.

### Exemplo

```kotlin
    private fun setupCafFaceLiveness() {
        smartAuth = CafSmartAuth.CafBuilder("myMFAToken", this)
            .setStage(CafStage.PROD)
            .setEmailUrl("myEmailUrl") // Não obrigatório
            .setPhoneUrl("myPhoneUrl") // Não obrigatório
            .setFaceAuthenticatorSettings(
                CafFaceAuthenticatorSettings(
                    "myFaceAuthToken",
                    false,
                    true,
                    CafFilterStyle.LINE_DRAWING
                )
            )
            .setThemeConfigurator(
                CafThemeConfigurator(
                    lightTheme = CafTheme(
                        backgroundColor = "#FFFFFF",
                        textColor = "#FF000000",
                    )
                    darkTheme = CafTheme(
                        backgroundColor = "#FF000000",
                        textColor = "#FFFFFF",
                    )
                )
            )
            .build()
    }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.caf.io/caf-sdk/caf-sdk-pt-br/android/standalone-modules/cafsmartauth/builder.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
