> 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/react-native/standalone-modules/cafsmartauth/getting-started.md).

# Primeiros passos

Toda a integração será baseada nos arquivos já presentes no [repositório de exemplo](https://github.com/combateafraude/identity-reactnative-sdk).

{% hint style="warning" %}
Por motivos de segurança, nosso repositório é privado; se você quiser realizar a integração com o produto, entre em contato com a pessoa responsável pelo seu serviço.
{% endhint %}

## Android

1. Copie os arquivos **`CombateAFraudeModule.java`** e **`CombateAFraudePackage.java`**, localizados no repositório de exemplo no caminho `SDKsExample/android/app/src/main/java/com/sdksexample/` \*\*\*\* para a pasta \*\*\*\* `<root-project>/android/app/src/main/java/com/<your-package-name>` no seu projeto.

> Observação: a função **`getName`** será usada para chamar o método no lado do React Native; o método anotado com @ReactMethod será usado para as chamadas no lado do React Native.

2\. Referencie o módulo no seu **`MainApplication.java`**

```java
import com.<your-package-name>;

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    ...
    packages.add(new CombateAFraudePackage());
    ...
}
```

3\. No `<root-project>/android/build.gradle` arquivo, adicione nosso repositório Maven e a **`minSdkVersion`** configuração para, no mínimo, a API 21:

```groovy
buildscript {
    ext {
        minSdkVersion = 21
    }
}

allprojects {
    repositories {
        maven { url "https://repo.combateafraude.com/android/release" }
    }
}
```

4\. No `<root-project>/android/app/build.gradle` arquivo, adicione nossas configurações do projeto:

```groovy
android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    aaptOptions {
        noCompress "tflite"
    }

    dataBinding {
        enabled = true
    }
}
```

5\. No mesmo arquivo, adicione as dependências do Identity:

```groovy
dependencies {
    implementation 'com.combateafraude.sdk:identity:<sdk_version>'
}
```

6\. Atualize as dependências executando os seguintes comandos:

```bash
cd android
./gradlew clean bundleRelease
./gradlew build --refresh-dependencies
```

> **Observação:** Verifique se você está executando a versão 1.8 do Java. Se não, execute:

```bash
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
```

### iOS

1. No **`<root-project>/ios/Podfile`**, certifique-se de que a versão mínima do iOS seja 12.4+, adicione a linha **`use_frameworks!`** e desative o Flipper:

```swift
platform :ios, '12.4'
use_frameworks!

target '<app-name>' do
 ...
 # Observe que, se você tiver o use_frameworks! habilitado, o Flipper não funcionará e
 # você deve desativar as próximas linhas.
 # use_flipper!
 # post_install do |installer|
 #   flipper_post_install(installer)
 # end
end

target '<app-name>-tvOS' do
 ...
end

source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/'
```

2\. No mesmo arquivo, adicione os SDKs de iOS que você quer usar:

```swift
target '<app-name>' do
 pod 'Identity', '~> <version>'
end
```

3\. Execute o comando **`cd ios && pod install && cd ..`** para instalar as dependências

4\. Copie os **`SDKsExample-Bridging-Header.h`**, **`CombateAFraude.m`** e **`CombateAFraude.swift`** arquivos, localizados no repositório no caminho \*\*`SDKsExample/ios` \*\*, para a **`<root-project>/ios`** pasta

5\. Caso você tenha algum problema ao executar o projeto após concluir todas as etapas, adicione esta linha de código no seu Podfile e execute o comando **`cd ios && pod install && cd ..`**

```ruby
post_install do |installer|
  fix_deployment_target(installer)
  enable_bitcode(installer)
end

# Isso resolve qualquer possível problema de deployment, garantindo que seja o mesmo do projeto
def fix_deployment_target(installer)
  return if !installer
  project = installer.pods_project
  project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']

  puts "Certifique-se de que o deployment target de todos os pods seja #{project_deployment_target.green}"
  project.targets.each do |target|
    puts "  #{target.name}".blue
    target.build_configurations.each do |config|
      old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      new_target = project_deployment_target
      next if old_target == new_target
      puts "    #{config.name}: #{old_target.yellow} -> #{new_target.green}"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
    end
  end
end

def enable_bitcode(installer)
  return if !installer
  installer.pods_project.build_configurations.each do |config|
    # config.build_settings['ENABLE_BITCODE'] = 'YES'
    # config.build_settings['OTHER_CFLAGS'] = '-fembed-bitcode'
    # config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
    config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
    config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
  end
end

```

### Chamando os códigos da aplicação

O **`App.js`** arquivo no repositório de exemplo mostra como chamar esses métodos e acessar seus resultados.


---

# 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/react-native/standalone-modules/cafsmartauth/getting-started.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.
