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 🙏

© 2026 – Pkg Stats / Ryan Hefner

privacy-kit-cl

v0.3.0

Published

Cumplimiento Ley 21.719 (Chile) para sistemas con IA — capa acoplable, multi-canal de mensajería (WhatsApp, SMS, Telegram, web chat, email). El código JavaScript vive en node/.

Readme

privacy-kit-cl 🛡️

Cumplimiento de la Ley 21.719 (protección de datos, Chile) para sistemas con IA/LLMs — sin reescribir lo que ya funciona.

npm Python License status

Módulo independiente y reutilizable para cumplir la Ley 21.719 (Protección de Datos Personales de Chile) en cualquier sistema que trate datos personales — especialmente sistemas con IA/LLMs que interactúan con clientes por cualquier canal de mensajería (WhatsApp, SMS, Telegram, web chat, email…).

Disponible en Python y Node.js, con la misma API.

La idea: en vez de reimplementar el cumplimiento en cada proyecto, se acopla este kit como una capa transversal. Un desarrollador (o una IA) instala el paquete, lo configura con un archivo declarativo, y envuelve los puntos donde entra/sale/procesa un dato personal.

Qué resuelve (mapeo a la ley)

| Componente | Artículo/principio 21.719 | Qué hace | |---|---|---| | consent | Base de licitud, consentimiento | Captura y registra consentimiento con evidencia (quién, cuándo, para qué). | | redaction | Minimización, seguridad | Detecta y anonimiza PII antes de mandarla a un LLM o a terceros. | | rights | Derechos ARCOP+ | Handlers de Acceso, Rectificación, Cancelación/supresión, Oposición y Portabilidad. | | retention | Calidad, plazos | Políticas de retención y borrado automático (derecho al olvido). | | transfers | Transferencia a terceros | Registro de a qué terceros (OpenAI, Anthropic, pasarelas…) se envían datos. | | audit | Responsabilidad proactiva | Bitácora inmutable de cada acceso/tratamiento de dato personal. | | notice | Transparencia | Genera el aviso de privacidad y su entrega en el primer contacto. |

Cómo funciona

Principios de diseño

  1. Independiente: no depende de tu framework. Core sin dependencias externas + una interfaz de almacenamiento (store) que adaptas a Mongo, ClickHouse, Postgres, etc.
  2. Declarativo: todo el comportamiento sale de un archivo de configuración (categorías de datos, finalidades, plazos, terceros). Cambiar la política = cambiar config, no código.
  3. Acoplable por envoltura: envuelves las llamadas sensibles (redact(...), transfers.log(...), audit.record(...)) sin reescribir tu lógica.
  4. AI-friendly: el archivo AGENTS.md le dice a una IA exactamente cómo integrar el kit en un sistema nuevo o existente.

Implementaciones

El repo contiene dos paquetes independientes, uno por lenguaje, con la misma API. Instala solo el que necesites.

| Lenguaje | Código | Manifiesto | Prueba | |---|---|---|---| | Python | python/privacy_kit/ | pyproject.toml | python python/examples/smoke_test.py | | Node.js | node/src/ | package.json | npm test |

Ambos exponen los mismos componentes (redaction, consent, rights, transfers, audit, retention, notice, store) y son agnósticos del canal de mensajería.

Instalación

Python (pip):

pip install "git+https://github.com/Yugoxc/privacy-kit-cl.git"
# en local, desde el repo:  pip install .

Node.js (npm):

npm install privacy-kit-cl

Uso

Python

from privacy_kit import PrivacyKit

pk = PrivacyKit.from_config("privacy.config.yaml")   # sin archivo, usa DEFAULT_CONFIG

# 1) Antes de mandar texto de un cliente a un LLM (cualquier canal):
red = pk.redaction.redact(user_message, subject_id=rut)   # -> RedactionResult(text, token_map, found)
pk.transfers.log(subject_id=rut, destino="anthropic", finalidad="asistencia_venta",
                 categorias=list(red.found.keys()))

# 2) Enviar SOLO red.text al LLM; luego rehidratar la respuesta al cliente:
respuesta = pk.redaction.rehydrate(llm(red.text), red.token_map)

# 3) Auditar el tratamiento:
pk.audit.record(subject_id=rut, accion="procesar_mensaje", sistema="bot:whatsapp")

Node.js

const { PrivacyKit } = require("privacy-kit-cl");

const pk = PrivacyKit.fromConfig("privacy.config.json"); // o .fromObject({...})

const red = pk.redaction.redact(userMessage, subjectId); // -> { text, tokenMap, found }
pk.transfers.log(subjectId, "anthropic", "asistencia_venta", Object.keys(red.found));

const respuesta = pk.redaction.rehydrate(await llm(red.text), red.tokenMap);

Ejemplos completos multi-canal: python/examples/messaging_integration.py · node/examples/messaging_integration.js.

Panel de administración (opcional)

Módulo admin opcional: levanta un mini-servidor (sin dependencias) con API REST + UI para gestionar los datos que el kit registra —consentimientos, transferencias, auditoría, ROPA— y ejecutar el derecho al olvido (borrar todos los datos de un titular). Se activa por config; si está apagado, no levanta nada.

Activar:

// Node
const pk = PrivacyKit.fromObject({ adminUi: { enabled: true, port: 8787, token: "un-token-secreto" } });
pk.serveAdmin();
# Python (con admin_ui.enabled: true en el config)
pk.serve_admin()

API REST (requiere header Authorization: Bearer <token>):

| Método | Ruta | Qué hace | |---|---|---| | GET | /api/resolve?q=<dato> | Busca subject_id(s) por RUT/email/teléfono (requiere resolver registrado). | | GET | /api/subject?id=<id> | Todo lo del titular: consentimientos, transferencias, datos en fuentes y auditoría. | | POST | /api/subject/forget {id} | Derecho al olvido: borra todos sus datos (la auditoría se conserva como evidencia). | | GET | /api/ropa | Registro de Actividades de Tratamiento. | | GET | /api/health | Estado. |

Buscar por dato (RUT/email): como el subject_id es un id interno (idealmente un hash), tu integración registra un resolver que sabe mapear el dato real al id:

pk.rights.registerResolver(rut => db.usuarios.find({ rut }).map(u => u.subjectId)); // node
pk.rights.register_resolver(lambda rut: [u["subject_id"] for u in db.find("usuarios", {"rut": rut})])  # python

⚠️ Superficie sensible: exponla solo en red interna/VPN y siempre con token. Cada acción queda auditada.

Casos de uso

Aplica a cualquier sistema que trate datos personales (RUT, nombre, teléfono, email, dirección…), tenga IA o no. Las finalidades del config son ejemplos multi-rubro (asistencia_venta, soporte, agendamiento, cobranza, reclutamiento, verificacion_identidad, notificaciones, marketing…): cámbialas por las tuyas.

  • Con IA / chat (bots y agentes con LLM): el foco es redaction — enmascarar la PII antes de enviarla al modelo, más el registro de transferencia. → ejemplo messaging_integration.
  • Sin IA (formularios web, APIs de registro, CRM, RRHH, cobranza): se usan consent, retention, audit y rights (ARCOP), sin redaction. → ejemplo web_form_integration.

Ejemplos completos: python/examples/ · node/examples/.

Estado

Scaffold base (esqueleto funcional con interfaces y stubs). Diseñado para crecer proyecto a proyecto. No es asesoría legal — validar con abogado antes de producción.