Apps Móviles
PreLogin es la primera línea de defensa: un conjunto de verificaciones que se disparan apenas se abre la app móvil, antes de que el usuario interactúe con la pantalla de login. Las sesiones comprometidas se marcan (o bloquean) antes de llegar a la autenticación.
Antes de integrar, instala el SDK en Getting Started → Instalar el SDK →
Monitoreo de Seguridad
Inicia el monitoreo RASP continuo en segundo plano usando securityCheckConfig . El callback detectionAction se ejecuta en cada ciclo de escaneo con el resultado agregado.
Android / Flutter: llama esto en Application.onCreate() o State.initState() del widget raíz. iOS / Capacitor iOS: llama esto en AppDelegate.application(_:didFinishLaunchingWithOptions:) o el equivalente en tu framework.
// Application.onCreate()
val smartIDPrevention = SmartID.securityCheckConfig(
license = "YOUR_KEY",
channelId = 1,
config = SmartID.Config(
interval = 1,
timeout = 1,
permissions = listOf(SmartID.Permission.CAMERA),
overlayProtection = true,
blockCellphoneScreen = true
),
detectionAction = { detected, categories ->
if (detected) {
// block, redirect, or send categories to your backend
}
}
)
smartIDPrevention.startSecurityChecks() Para detener el monitoreo:
// onDestroy() or onStop()
smartIDPrevention.stopSecurityChecks() // AppDelegate.application(_:didFinishLaunchingWithOptions:)
SmartID.shared.startLocation()
let smartIDPrevention = SmartID.shared.securityCheckConfig(
license: "YOUR_KEY",
channelId: 1,
config: SmartID.Config(
interval: 1,
timeout: 1,
permissions: [.camera],
overlayProtection: true,
blockCellphoneScreen: true
),
detectionAction: { detected, categories in
if detected {
// block, redirect, or send categories to your backend
}
}
)
smartIDPrevention.startSecurityChecks() Para detener el monitoreo:
// applicationWillResignActive or sceneDidEnterBackground
smartIDPrevention.stopSecurityChecks() // State.initState()
final _prevention = SmartID.securityCheckConfig(
license: 'YOUR_KEY',
channelId: 1,
config: SmartID.Config(
interval: 1,
timeout: 1,
permissions: [SmartID.Permission.camera],
overlayProtection: true,
blockCellphoneScreen: true,
),
detectionAction: (detected, categories) {
if (detected) {
// block, redirect, or send categories to your backend
}
},
);
_prevention.startSecurityChecks() Para detener el monitoreo:
// State.dispose()
_prevention.stopSecurityChecks() import { SmartID } from 'capacitor-smartid';
// iOS only — initialize GPS sensor before monitoring
await SmartID.startLocation();
await SmartID.startSecurityChecks({ license: 'YOUR_KEY', channelId: 1 });
SmartID.addListener('securityReasons', (result) => {
if (result.reasons.length > 0) {
// block, redirect, or send result.reasons to your backend
}
});
// Android only — screen capture protection
await SmartID.startBlockCellphoneScreen({ enableScreen: true, enableApp: true });
// Android only — overlay attack protection
const overlay = await SmartID.enableOverlayProtection(); Para detener el monitoreo:
await SmartID.stopSecurityChecks();
SmartID.removeAllListeners(); Solo incluye en permissions los permisos ya declarados en tu AndroidManifest.xml / Info.plist y concedidos por el usuario en runtime. El SDK no los solicitará.
Referencia
securityCheckConfig
| Parámetro | Tipo | Descripción |
|---|---|---|
license | String | Clave de licencia SmartID |
channelId | Int | Identificador de canal |
config | SmartID.Config | Configuración del ciclo de escaneo |
detectionAction | (Boolean, List<String>) -> Unit/(Bool, [String]) -> Void | Callback ejecutado en cada ciclo |
detectionAction — parámetros del callback
| Parámetro | Tipo | Descripción |
|---|---|---|
detected | Boolean/Bool | true si algún control RASP fue activado |
categories | List<String>/[String] | Nombres de los controles que dispararon |
SmartID.Config
| Parámetro | Tipo | Descripción |
|---|---|---|
interval | Int | Segundos entre escaneos consecutivos |
timeout | Int | Segundos máximos por escaneo |
permissions | List<Permission>/[Permission] | Permisos ya declarados y concedidos |
overlayProtection | Boolean/Bool | Bloquea ataques de overlay mientras el monitoreo está activo |
blockCellphoneScreen | Boolean/Bool | Impide la captura o duplicación de pantalla |
SmartID.Permission
Android
| Valor | Permiso en AndroidManifest |
|---|---|
CAMERA | android.permission.CAMERA |
LOCATION | ACCESS_FINE_LOCATION |
PHONE_STATE | READ_PHONE_STATE |
BLUETOOTH | BLUETOOTH_CONNECT |
iOS
| Valor | Clave en Info.plist |
|---|---|
.camera | NSCameraUsageDescription |
.location | NSLocationWhenInUseUsageDescription |
.motion | NSMotionUsageDescription |
.bluetooth | NSBluetoothAlwaysUsageDescription |
Android/iOS/Flutter: cuando detected = true, el array categories contiene los nombres de los controles RASP que dispararon. Capacitor: result.reasons contiene códigos numéricos de los controles. Opciones comunes: bloquear la pantalla de login, redirigir a un flujo de error, o enviar los datos a tu backend para scoring de riesgo.