API

Variables

TalsecConfig

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

field
type
description
sample value

expectedPackageName

String

Package name of the app.

"com.talsec.freerasp.demoapp"

expectedSigningCertificateHashBase64

Array<String>

Certificate hashes of your app. You must get your expected signing certificate hashes in Base64 form. You can go through this manual to learn how to sign your app in more detail, including manual signing and using Google's Play app signing.

arrayOf( "mVr/qQLO8DKTwqlL+B1qigl9NoBnbiUs8b4c2Ewcz0k=")

watcherMail

String?

The value is automatically used for Security Reports, Product Updates, and Talsec Portal updates, learn more.

Mail has a strict form '[email protected]'.

supportedAlternativeStores

Array<String>

Package names of the alternative stores on which you are publishing the application. The Google Play Store and Huawei AppGallery, are included internally. (You can assign just emptyArray()). For more information, visit the Detecting Unofficial Installationarrow-up-right wiki page.

arrayOf( "com.sec.android.app.samsungapps")

isProd

Boolean?

Defaults to true when undefined. If you want to use the Dev version to make the development process viable, set the parameter to false. 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 BuildConfig.BUILD_TYPE.contains("Release", true) as a value for isProd.

true

killOnBypass

Boolean?

Defaults to false .

Determines whether the app should be killed within the SDK, if the callbacks are hooked or modified by an attacker.

true


Classes

class ThreatListener

Constructor

constructor(threatsCallback: ThreatDetected, deviceStateCallback: DeviceState? = null, raspExecutionCallback: RaspExecutionState? = null)

  • Listener for the threats detected by freeRASP.

Methods

fun registerListener(context: Context)

  • Registers your reactions to detected threats with freeRASP.

fun unregisterListener(context: Context)

  • Unregisters the reactions to detected threats.

object Talsec

Methods

fun start(context: Context, config: TalsecConfig, mode: TalsecMode? = TalsecMode.BACKGROUND)

  • The method used to start freeRASP's functionality. TalsecMode is an optional parameter that can be used to force the execution of freeRASP in FOREGROUND / BACKGROUND thread (default value is TalsecMode.BACKGROUND).

fun blockScreenCapture(activity: Activity, enable: Boolean)

  • The method used to block/unblock screen capture.

fun isScreenCaptureBlocked(): Boolean

  • The method used to know the state of screen capture blocking whether blocked or not.

fun storeExternalId(context: Context, externalId: String): ExternalIdResult

  • Validates and stores a custom identifier (External ID) for the user.

    • Requirements:

      • Allowed characters: Alphanumeric (a-z, A-Z, 0-9) and special characters: +, _, -, /, :, =.

    • Returns:

      • ExternalIdResult.Success if the ID is valid and stored, or ExternalIdResult.Error if the ID violates the requirements (the ID will not be stored).

fun removeExternalId(context: Context)

  • Removes the previously stored External ID.


Abstract Classes

public abstract class ThreatDetected

Sends callbacks to your app when a threat is detected. Read more about the meaning of the callbacks in the wiki.

Methods:

  • open fun onRootDetected()

  • open fun onDebuggerDetected()

  • open fun onEmulatorDetected()

  • open fun onTamperDetected()

  • open fun onUntrustedInstallationSourceDetected()

  • open fun onHookDetected()

  • open fun onDeviceBindingDetected()

  • open fun onObfuscationIssuesDetected()

  • open fun onScreenshotDetected()

  • open fun onScreenRecordingDetected()

  • open fun onMultiInstanceDetected()

  • open fun onLocationSpoofingDetected()

  • open fun onTimeSpoofingDetected()

  • open fun onUnsecureWifiDetected()

  • open fun onAutomationDetected()

  • open fun onMalwareDetected(suspiciousApps: List<SuspiciousAppInfo>)

circle-info

Methods have default empty implementations, so you only need to override the ones you want to handle.

abstract class DeviceState

Provides device state listener to get additional information about device state. Read more about the meaning of the device state listeners in the wiki.

Methods:

  • open fun onUnlockedDeviceDetected()

  • open fun onHardwareBackedKeystoreNotAvailableDetected()

  • open fun onDeveloperModeDetected()

  • open fun onADBEnabledDetected()

  • open fun onSystemVPNDetected()

abstract class RaspExecutionState

A class which represents a set of callbacks that are used to notify the application when state of executing RASP checks changes.

Methods:

  • open fun onAllChecksFinished()

sealed interface ExternalIdResult

Represents the result of the storeExternalId operation.

Subclasses:

  • class Success - Indicates that the externalId was successfully validated and stored.

  • class Error(val errorMsg: String) - Indicates that validation failed due to invalid characters. Contains a description of the error.

Last updated