SLM Forge
SDK v3.6.0
Tester SDK

Catálogo de plugins

Plugins Cordova on-device para construir apps mobile con Forge. Todos comparten un mismo SDK slm.* expuesto desde el WebApiFramework.

27Plugins
7Categorías
v3.6.0SDK actual

Core / Browser

Plugins siempre incluidos por default. Forman la base de cualquier app Forge.

InAppBrowser v1.0.0 core
cordova-plugin-slm-inappbrowser
Navegador integrado que carga la webapp. Toda la lógica corre dentro de este WebView; el host Cordova solo provee plugins nativos.

Es la base sobre la que viven los demás plugins. Configurable via config.xml con la URL inicial del proyecto.

Funciones expuestas

slm.openExternal(url)
Splash Screen v1.0.0 core
cordova-plugin-slm-splashscreen
Pantalla de carga al iniciar la app. En Forge el auto-show está deshabilitado: el index.html del IAB es la experiencia de splash real.

API

slm.showSplash();
slm.hideSplash();
Status Bar v1.0.0 core
cordova-plugin-slm-statusbar
Color, estilo y visibilidad de la barra de estado iOS/Android, incluso dentro del Dialog del IAB.

API

slm.setStatusBarColor('#1B2A4A', { style: 'lightContent' });
slm.setStatusBarTransparent(true);
slm.hideStatusBar();
slm.showStatusBar();
Network v1.0.0 core
cordova-plugin-slm-network
Detección de conectividad y cambios de red en tiempo real (WiFi, celular, sin conexión).

API

slm.getNetworkInfo().then(r => {
    // r = { type: 'wifi'|'cellular'|'none', online: bool }
});
slm.onNetworkChange(state => { /* ... */ });

Identidad / KYC

Verificación de identidad on-device: documento + facial + biometría.

Document Capture v1.3.0 breaking
cordova-plugin-slm-document-capture
Cámara embebida con overlay HTML/CSS nativo + OCR (INE, pasaporte). Templates de crop predefinidos.

Templates

credential-front (1.586:1) credential-back face (0.75:1) passport (0.704:1) document custom

API

slm.startDocumentCamera({
    x, y, width, height,
    camera: 'back',
    borderRadius: 16,
    overlayHtml: '<html>...</html>',
    overlayInteractive: false
});

slm.onDocumentDetected(e => { /* { detected, type } */ });

const r = await slm.captureDocument({
    template: 'credential-front',
    ocr: true,
    quality: 0.9
});
// r.image, r.data { nombre, curp, ... }, r.text, r.blocks

slm.switchDocumentCamera();
slm.focusDocumentCamera();
slm.stopDocumentCamera();

Breaking 1.3.0: compareFaces se movió a face-verify. El SDK lo redirige automáticamente.

Face Verify v1.0.0 nuevo
cordova-plugin-slm-face-verify
Verificación facial con MobileFaceNet (TFLite + GPU/Neural Engine). Cosine similarity entre embeddings 192-dim. ~10 MB del modelo embebido.

Pipeline

  1. Detección de cara (Vision iOS / ML Kit Android)
  2. Affine 3-pts (ojos + boca → InsightFace canonical)
  3. Crop 112×112 RGB normalizado (-1, 1)
  4. Inferencia MobileFaceNet → embedding 192-dim
  5. Cosine similarity + sigmoid mapping

API

slm.startFaceVerify({
    x, y, width, height,
    borderRadius: 24,
    overlayHtml: '<html>...</html>',
    mirror: true
});

const selfie = await slm.captureSelfieForVerify();
// selfie.image (foto), selfie.aligned (crop 112x112)

const r = await slm.compareFaces({
    image1: ineBase64,
    image2: selfieBase64,
    threshold: 60
});
// r.match, r.score (0-100), r.cosine, r.model

slm.closeFaceVerify();

Score esperable

Misma persona típica: cosine 0.6 → score 92. Distintas: cosine 0.3 → score 23. Threshold default 60.

No tiene peso legal. Para KYC formal complementar con AWS Rekognition / Azure Face API server-side.

Liveness Check v1.1.0
cordova-plugin-slm-liveness
Prueba de vida facial — 8 retos (parpadeo, sonrisa, giro) con cámara embebida y overlay HTML/CSS nativo.

Retos disponibles

blinksmile turnLeft / turnRight tiltLeft / tiltRight open / close

API

slm.startLivenessCamera({
    x, y, width, height,
    smileThreshold: 0.3,
    turnThreshold: 25,    // grados
    overlayHtml: '<html>...</html>'
});

slm.onLivenessEvent(e => { /* yaw, roll, smile, eyeL, eyeR */ });
slm.runLivenessChallenge({ challenge: 'blink' });
slm.captureLivenessPhoto();
slm.stopLivenessCamera();

Liveness verifica que es persona real (no foto/video). Face Verify verifica que es la misma persona del INE. Suelen complementarse.

Signature Pad v1.1.0 embedded mode
cordova-plugin-slm-signature
Firma digital con pad táctil. Modo modal fullscreen o embebido con HTML detrás/encima del canvas. Bezier suavizado, auto-crop, PNG con o sin transparencia.

Modo modal (fullscreen nativo)

const r = await slm.captureSignature({
    title: 'Firma aquí',
    subtitle: 'Contrato de apertura',
    penColor: '#000',
    penWidth: 3,
    backgroundColor: '#fff',
    showDate: true,
    showLine: true
});
// r.image (PNG base64), r.width, r.height

Modo embebido (pad nativo en rect, HTML detrás/encima)

await slm.startSignaturePad({
    x: 20, y: 240, width: 320, height: 180,
    borderRadius: 16,
    penColor: '#1a1a1a', penWidth: 3,
    backgroundColor: 'transparent',    // deja ver el HTML de atrás
    backgroundHtml: '<div style="...">Firme aquí</div>',
    overlayHtml: '<div style="...">FIRMA DIGITAL</div>',
    overlayInteractive: false,    // taps pasan al pad
    freezeHtml: '<div>Confirmando firma...</div>'
});

const sig = await slm.getSignature({
    crop: true,                    // auto-crop al bounding box
    background: 'white'           // 'transparent' | hex (override del export)
});
// sig.image (PNG base64), sig.width, sig.height, sig.hasInk

await slm.clearSignature();              // limpia trazos
await slm.freezeSignaturePad();          // bloquea pad + muestra freezeHtml
await slm.unfreezeSignaturePad();        // re-habilita
await slm.stopSignaturePad();            // cierra y libera

Capas del modo embebido

De abajo hacia arriba: backgroundHtml (marco decorativo, gradiente, "X" de firmante) → canvas nativo (transparente cuando backgroundColor: 'transparent') → overlayHtml (botones flotantes, branding, hints). Con overlayInteractive: false los taps pasan al pad sin que el overlay los consuma. freezeHtml se pre-carga oculto y se muestra con freezeSignaturePad() — útil para "preview de firma" antes de confirmar.

Biometric v1.0.0
cordova-plugin-slm-biometric
Autenticación con Face ID, Touch ID o huella del sistema. Reusa la confianza biométrica del OS.

API

const info = await slm.checkBiometric();
// { available, type: 'face'|'touch'|'fingerprint', enrolled }

const r = await slm.authenticateBiometric({
    reason: 'Confirmar transferencia',
    fallbackTitle: 'Usar PIN'
});
// r.success, r.error

Cámara y captura

Cámara, fotos, video, escaneo de códigos.

Camera v1.0.0
cordova-plugin-slm-camera
Acceso a la cámara para tomar foto. Devuelve base64 o ruta del archivo.

API

const r = await slm.takePicture({
    quality: 0.85,
    camera: 'back',
    format: 'base64'
});
Media Capture v1.0.0
cordova-plugin-slm-media-capture
Captura de fotos y video con la app de cámara nativa del sistema.

API

slm.captureImage(opts);
slm.captureVideo({ duration: 30 });
Media Picker v1.0.0
cordova-plugin-slm-media-picker
Selector de fotos y video sin permisos de galería (Photo Picker nativo iOS/Android).

iOS 14+ usa PHPickerViewController. Android 13+ usa ACTION_PICK_IMAGES. Sin necesidad de permiso de galería completa.

API

const r = await slm.pickMedia({
    type: 'image',    // 'image' | 'video' | 'any'
    multiple: true,
    limit: 5
});
QR Scanner v1.0.0
cordova-plugin-slm-qr
Escaneo de QR / códigos de barras embebido o fullscreen, con overlay HTML/CSS nativo.

Modos

  • Fullscreen: slm.scanQR() abre el lector a pantalla completa.
  • Embedded: slm.openQRPreview({x, y, width, height, overlayHtml}) coloca la cámara en un rect con overlay nativo.

API

const r = await slm.scanQR();
// r.value, r.format ('qr', 'ean13', 'code128', ...)

slm.openQRPreview({
    x, y, width, height,
    overlayHtml: '<html>...marco verde + scan-line...</html>'
});

slm.onQRDetected(value => { /* ... */ });
slm.closeQRPreview();
Device Info v1.1.0
cordova-plugin-slm-device-info
Información del dispositivo (modelo comercial, OS, UUID) — incluye nombre amigable como "iPhone 15 Pro" en logs.

API

const info = await slm.getDeviceInfo();
// { model, modelName, manufacturer, os, osVersion, uuid, locale }

Archivos y media

Manejo de documentos: selección, visualización, descarga.

File Picker v1.0.0
cordova-plugin-slm-filepicker
Selector de archivos del dispositivo (PDF, documentos Office, imágenes, etc.).

API

const r = await slm.pickFile({
    types: ['pdf', 'image/*'],
    multiple: false
});
// r.name, r.uri, r.size, r.mime, r.base64
PDF Viewer v1.0.0
cordova-plugin-slm-pdf-viewer
Visor de PDF inline — URL, base64 o archivo local. Zoom, navegación entre páginas, compartir.

API

slm.openPDF({
    url: 'https://example.com/contrato.pdf',
    // o:
    base64: 'JVBERi0xLjQKJ...',
    title: 'Contrato',
    allowShare: true
});
slm.closePDF();
Download Manager v1.0.0
cordova-plugin-slm-download
Descarga de archivos con progreso en tiempo real, headers de autenticación, abrir con app nativa.

API

slm.downloadFile({
    url: 'https://api/file.zip',
    headers: { Authorization: 'Bearer ...' },
    filename: 'state.zip',
    openOnFinish: true
}, progress => console.log(progress.percent));

Geo / Comunicación

Ubicación, push, share, wallets.

Geolocation v1.0.0
cordova-plugin-slm-geolocation
Ubicación GPS con permisos managed, watch continuo, settings deep-link.

API

const pos = await slm.getGPS({ accuracy: 'high' });
// pos.lat, pos.lng, pos.accuracy

const id = slm.watchGPS(pos => { /* updates */ });
slm.clearWatch(id);

slm.openLocationSettings();
Push Notifications v1.2.3
cordova-plugin-slm-notifications
Push via Firebase Cloud Messaging — sonidos custom, canales urgent/normal, cold-start tap.

API

const token = await slm.registerPush();
slm.onNotification(payload => { /* tapped o foreground */ });

// Cold-start: app abierta desde notif con killed state
const initial = await slm.getInitialNotification();
if (initial) { /* enrutar */ }

slm.registerPushWithBackend({
    url: 'https://api/push/register',
    headers: { Authorization: '...' },
    extra: { userId: 'abc' }
});
Share v1.2.0
cordova-plugin-slm-share
Compartir contenido (texto, URL, imagen, PDF, archivo) con otras apps via sheet del sistema.

API — texto / URL / imagen

slm.share({
    title: 'Compartir',
    text: 'Mira mi cuenta',
    url: 'https://...',
    image: 'iVBORw0KGgo...'  // base64 (sin data: o con data URL)
});

API — PDF

slm.share({
    pdf: 'JVBERi0xLjQK...',        // base64 del PDF
    fileName: 'factura.pdf',    // opcional, default "documento.pdf"
    text: 'Adjunto factura'      // opcional, va como texto adicional
});

API — archivo generico

slm.share({
    file: 'UEsDBAo...',           // base64
    fileName: 'reporte.xlsx',
    mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
});

Acepta tanto base64 puro como data URL (data:application/pdf;base64,...). Pasa solo uno de image/pdf/file por llamada. Los archivos se guardan en cache temporal y se limpian a la hora.

Wallet Provisioning v1.0.0
cordova-plugin-slm-wallet-provisioning
Provisioning de tarjetas en Apple Pay / Google Pay con flow nativo.

API

const r = await slm.provisionCard({
    issuerToken: '...',    // del backend del banco
    cardholder: 'Sergio Guerrero',
    last4: '1234'
});

Sistema / Seguridad

Integridad, attestation, deep links, permisos.

App Integrity v1.0.0
cordova-plugin-slm-integrity
Detecta jailbreak, root, debugger, emulador, screen recording. Previene screenshots con flag.

API

const info = await slm.checkIntegrity();
// { jailbroken, debugger, emulator, screenRecording, suspicious }

slm.preventScreenshots(true);
slm.onScreenRecord(active => { /* ... */ });
App Attest v1.0.0
cordova-plugin-slm-app-attest
iOS App Attest + Android Play Integrity. Genera tokens criptográficos firmados por Apple/Google que validan que la app es legítima.

API

const token = await slm.attestApp({
    nonce: 'server-generated-nonce'
});
// Mandar token al backend para validación con Apple/Google
Deep Links v1.0.0
cordova-plugin-slm-deeplinks
Universal Links iOS + App Links Android. Abre la app desde URLs https específicas (cold y warm start).

API

slm.onDeepLink(url => { /* ej: https://app.com/ref/ABC */ });

const initial = await slm.getInitialDeepLink();
// URL que abrió la app desde killed state, o null
Permissions v1.0.0
cordova-plugin-slm-permissions
Control centralizado de permisos: check, request, openSettings (cámara, ubicación, micrófono, notificaciones).

API

const s = await slm.checkPermission('camera');
// { granted, denied, restricted, notDetermined }

const r = await slm.requestPermission('location');
slm.openAppSettings();   // si fue denegado
Device Info v1.1.0
cordova-plugin-slm-device-info
Modelo, OS, UUID, locale.
await slm.getDeviceInfo(); // { model, modelName, os, osVersion, uuid }

Input avanzado

Dictado por voz y control fino del teclado virtual.

Dictation v1.0.0
cordova-plugin-slm-dictation
Dictado por voz — convierte voz a texto usando reconocimiento nativo iOS Speech / Android SpeechRecognizer.

API

slm.startDictation({ locale: 'es-MX' }, partial => {
    // partial.text actualiza en tiempo real
});

const r = await slm.stopDictation();
// r.text final
Keyboard v1.0.0
cordova-plugin-slm-keyboard
Estado del teclado virtual: altura, frame, eventos show/hide. Detecta cierre nativo con flechita Android.

API

slm.onKeyboardChange(state => {
    // { visible, height, frame: { x, y, w, h } }
});

slm.showKeyboard();    // requiere input enfocado
slm.dismissKeyboard(); // cierre programático

Patrones comunes

Overlay HTML/CSS nativo (QR · Document Capture · Face Verify · Liveness)

Los plugins de cámara embebida montan un UIWindow (iOS) / FrameLayout (Android) encima del WebView principal. Los <div> que la webapp pinte quedan debajo de la cámara dentro del rect.

La solución: pasar overlayHtml u overlayUrl al plugin, que monta un WebView nativo transparente dentro del UIWindow del plugin, encima del preview. Ese overlay sí queda visible.

slm.startDocumentCamera({
    x, y, width, height,
    borderRadius: 16,           // esquinas redondeadas reales (CALayer / Outline)
    overlayHtml: '<html>...</html>', // HTML inline encima del preview
    overlayUrl: 'https://...',        // alternativa: URL externa
    overlayInteractive: false          // false (default): toques pasan al WebView principal
                                       // true: el overlay captura toques (botones funcionan)
});

Medir el rect de la cámara correctamente

En lugar de calcular {x, y, width, height} a mano, usa un <div> placeholder con tu layout flex y mídelo con getBoundingClientRect():

// HTML: <div id="camera-zone" style="flex:1;margin:8px 16px;"></div>
function getCameraRect() {
    const r = document.getElementById('camera-zone').getBoundingClientRect();
    return {
        x: Math.round(r.left),
        y: Math.round(r.top),
        width: Math.round(r.width),
        height: Math.round(r.height)
    };
}

// Doble requestAnimationFrame para asegurar layout listo
requestAnimationFrame(() => requestAnimationFrame(() => {
    const rect = getCameraRect();
    slm.startDocumentCamera({ ...rect, ...otherOpts });
}));

Boot del SDK

Toda página dentro del IAB debe esperar al SDK antes de llamar plugins. El bridge se establece via webkit.messageHandlers.cordova_iab (iOS) / equivalente Android.

const slm = new _SLMWAFK();
await slm.start();   // resuelve cuando el bridge nativo está listo
// ahora puedes llamar slm.* sin riesgo

Activar / desactivar plugin por proyecto

El panel admin (/projects/<id>) lista todos los plugins con un toggle. Los desactivados se quitan del package.json antes del cordova prepare, así no engordan el APK/IPA.

Por ejemplo, apps fintech sin KYC visual desactivan cordova-plugin-slm-face-verify y se ahorran ~10 MB del modelo MobileFaceNet.