npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

usiv-widget-sdk

v1.0.15

Published

USIV Verification Widget SDK - React component for biometric verification

Readme

USIV Widget SDK 🎯

SDK de verificación biométrica para cédulas chilenas con liveness detection. Widget embebible en cualquier página web.

📦 Instalación

npm install usiv-widget-sdk

🚀 Uso Rápido

import React from 'react';
import { UsivVerificationWidget, UsivSDKProvider } from 'usiv-widget-sdk';
import 'usiv-widget-sdk/dist/styles.css';

function App() {
  const verificationData = {
    verificationId: 'abc123',
    sessionToken: 'eyJhbGc...',
    rut: '17803819-2',      // opcional
    email: '[email protected]'  // opcional
  };

  const handleComplete = (result) => {
    console.log('Verificación completada:', result);
    // result.success: true/false
    // result.status: 'Validado' | 'No Validado'
    // result.steps: detalles de cada paso
  };

  const handleError = (error) => {
    console.error('Error:', error);
  };

  return (
    <UsivSDKProvider config={{ environment: 'development' }}>
      <UsivVerificationWidget
        verificationData={verificationData}
        onComplete={handleComplete}
        onError={handleError}
      />
    </UsivSDKProvider>
  );
}

🏗️ Flujo de Integración

1. Empresa obtiene API Key

// Backend de empresa
const response = await fetch('https://usivsdkapi-27rrhfccda-rj.a.run.app/v1/verifications', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer usiv_sk_r8QguZx982Lx1zCzdx6ft0k5CNihFgrMxDn97d4WCf4',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    rut: '17803819-2',
    email: '[email protected]'
  })
});

const { verificationId, sessionToken } = await response.json();

2. Empresa embebe widget

// Frontend de empresa
<UsivVerificationWidget
  verificationData={{ verificationId, sessionToken }}
  onComplete={(result) => {
    // Enviar resultado al backend
    fetch('/api/verification-complete', {
      method: 'POST',
      body: JSON.stringify(result)
    });
  }}
/>

🎯 Pasos del Widget

  1. 📱 Liveness Detection - Verificación biométrica del rostro
  2. 📄 Documento Frontal - Captura del frente de la cédula
  3. 🔄 Documento Reverso - Captura del reverso (MRZ)
  4. ✅ Resultado - Validación completa

💰 Sistema de Créditos

  • Liveness: 100 créditos
  • Documento frontal: 100 créditos
  • Documento reverso: 100 créditos
  • Total: 300 créditos por verificación completa

🔧 Configuración por Ambiente

// Desarrollo (default)
<UsivSDKProvider config={{ environment: 'development' }}>

// Producción
<UsivSDKProvider config={{ 
  environment: 'production',
  baseUrl: 'https://tu-backend-prod.com'
}}>

📋 Props del Widget

| Prop | Tipo | Requerido | Descripción | |------|------|-----------|-------------| | verificationData | object | ✅ | { verificationId, sessionToken, rut?, email? } | | onComplete | function | ❌ | (result: VerificationResult) => void | | onError | function | ❌ | (error: Error) => void | | className | string | ❌ | Clase CSS personalizada | | style | object | ❌ | Estilos CSS inline |

🎨 Personalización CSS

/* Contenedor principal */
.usiv-widget-container {
  max-width: 460px;
  margin: 0 auto;
}

/* Estados de resultado */
.usiv-result.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.usiv-result.failed {
  background: #fef2f2;
  border-color: #fecaca;
}

/* Pasos del wizard */
.usiv-step {
  padding: 24px;
}

.usiv-instructions {
  background: #f9fafb;
  padding: 16px;
  border-radius: 8px;
}

🔄 Respuesta de Verificación

interface VerificationResult {
  success: boolean;
  verificationId: string;
  status: string;
  steps: {
    liveness: { completed: boolean; result: string };
    documentFront: { completed: boolean; result: string };
    documentBack: { completed: boolean; result: string };
  };
}

🛡️ Seguridad

  • ✅ Tokens JWT con expiración (1 hora)
  • ✅ Validación de sesión en cada paso
  • ✅ AWS Rekognition para procesamiento biométrico
  • ✅ HTTPS obligatorio en producción

📞 Soporte

¿Problemas? Contacta a: [email protected]

📄 Licencia

MIT License - Ver archivo LICENSE para detalles