# API

## Types

### `TalsecConfig`

Specifies configuration for your app. See the table below for detailed description of the attributes.

<table><thead><tr><th width="158">field</th><th width="151">type</th><th width="232">description</th><th>sample value</th></tr></thead><tbody><tr><td>androidConfig</td><td>AndroidConfig?</td><td>Configuration for Android apps</td><td><em>any</em> <em>AndroidConfig instance</em></td></tr><tr><td>iosConfig</td><td>IOSConfig?</td><td>Configuration for iOS apps</td><td><em>any</em> <em>IOSConfig instance</em></td></tr><tr><td>watcherMail</td><td>string</td><td><p>The value is automatically used for Security Reports, Product Updates, and Talsec Portal updates, <a href="../../wiki/role-of-watchermail">learn more</a>.</p><p> Mail has a strict form <code>'name@domain.com'</code>.</p></td><td>'<code>john@example.com'</code></td></tr><tr><td>isProd</td><td>boolean?</td><td>Defaults to <code>true</code> when undefined. If you want to use the Dev version to make the development process easier, set the parameter to <code>false</code>. Make sure that you have the Release version in the production (i.e. isProd set to true)!. To simplify switching between debug and release version of freeRASP based on the build type, you can use <code>BuildConfig.BUILD_TYPE.contains("Release", true)</code> as a value for <code>isProd</code>.</td><td><code>true</code></td></tr><tr><td>killOnBypass</td><td>boolean?</td><td>Defaults to <code>false</code>. If set to <code>true</code>, the application will be terminated when the threat callbacks are suppressed or hooked.</td><td><code>true</code></td></tr></tbody></table>

### `AndroidConfig`

Specifies configuration for instances of the app running on Android devices. See the table below for detailed description of the attributes.

<table><thead><tr><th width="178">field</th><th width="87">type</th><th width="266">description</th><th>sample value</th></tr></thead><tbody><tr><td>packageName</td><td>string</td><td>Package name of the app.</td><td>'<code>com.talsec.freerasp.demoapp'</code></td></tr><tr><td>certificateHashes</td><td>string[]</td><td>Certificate hashes of your app.</td><td><code>['mVr/qQLO8DKTwqlL+B1qigl9NoBnbiUs8b4c2Ewcz0k=']</code></td></tr><tr><td>supportedAlternativeStores</td><td>string[]</td><td>Package names of the alternative stores. If you publish on the Google Play Store and Huawei AppGallery, as these are already included internally. (You can assign just <code>emptyArray()).</code> For more information, visit the <a href="https://github.com/talsec/Free-RASP-Community/wiki/Threat-detection#detecting-unofficial-installation">Detecting Unofficial Installation</a> wiki page.</td><td>[ <code>'com.sec.android.app.samsungapps']</code></td></tr></tbody></table>

### `IOSConfig`

Specifies configuration for instances of the app running on Android devices. See the table below for detailed description of the attributes.

<table><thead><tr><th width="160">field</th><th width="89">type</th><th>description</th><th>sample value</th></tr></thead><tbody><tr><td>appBundleId</td><td>string</td><td>Apple Bundle ID for the app</td><td>'<code>com.talsec.freerasp.demoapp'</code></td></tr><tr><td>appTeamId</td><td>string</td><td>Apple Team ID used in the app</td><td>'M8AK35...'</td></tr></tbody></table>

### `NativeEventEmitterActions`

Specifies a set of callbacks that are used to notify the application when certain security threat is detected.

#### Actions

<table><thead><tr><th width="316">threat</th><th width="241">type</th><th width="98" data-type="checkbox">Android</th><th width="84" data-type="checkbox">iOS</th><th data-hidden>description</th></tr></thead><tbody><tr><td><code>privilegedAccess</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>debug</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>simulator</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>appIntegrity</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>unofficialStore</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>hooks</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>deviceBinding</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>deviceID</code></td><td>() => any</td><td>false</td><td>true</td><td></td></tr><tr><td><code>passcode</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>secureHardwareNotAvailable</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>obfuscationIssues</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>devMode</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>adbEnabled</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>systemVPN</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>malware</code></td><td>`(apps: SuspiciousAppInfo[]) => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>screenshot</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>screenRecording</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>multiInstance</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>timeSpoofing</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr><tr><td><code>locationSpoofing</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>unsecureWifi</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr><tr><td><code>automation</code></td><td>() => any</td><td>true</td><td>false</td><td></td></tr></tbody></table>

### `RaspExecutionStateEventActions`

Callbacks for monitoring the execution state of RASP checks.

<table><thead><tr><th width="316">action</th><th width="241">type</th><th width="98" data-type="checkbox">Android</th><th width="84" data-type="checkbox">iOS</th><th data-hidden>description</th></tr></thead><tbody><tr><td><code>allChecksFinished</code></td><td>() => any</td><td>true</td><td>true</td><td></td></tr></tbody></table>

## Hooks

### `const useFreeRasp = (config: TalsecConfig, actions: NativeEventEmitterActions)`

React Custom Hook responsible for starting freeRASP and setting up listeners

## Methods

### `const setThreatListeners = async (config: NativeEventEmitterActions): void`

Sets up listeners for detected threats

### `const talsecStart = async (options: TalsecConfig): Promise<string>`

Method is used to start freeRASP's audit. Returns `'freeRASP started'`string when successful.

### `const removeThreatListeners = async (): void`

Unregisters threat listeners. Should be called only when the app is being terminated.

### `const blockScreenCapture = async (enable: boolean): Promise`\<string>

### `const isScreenCaptureBlocked = async (): Promise`\<boolean>

### `const storeExternalId = async (): Promise`\<string>

### `const removeExternalId = async (): Promise`\<string>


---

# Agent Instructions: 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:

```
GET https://docs.talsec.app/freerasp/freerasp/integration/react-native/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
