@devlas/dte-sii 2.21.1 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/SiiPortalAuth.js +15 -0
  2. package/package.json +1 -1
package/SiiPortalAuth.js CHANGED
@@ -510,6 +510,21 @@ class SiiPortalAuth {
510
510
  throw errLimite;
511
511
  }
512
512
 
513
+ // El certificado nunca fue habilitado como método de login en el SII: trámite manual
514
+ // único del contribuyente (sii.cl, Clave Tributaria, Cambiar clave, habilitar
515
+ // autenticación con Certificado Digital), no un problema del certificado en sí ni de
516
+ // esta librería. Sin esta deteccion caía en el genérico "no se recibieron cookies", que
517
+ // no dice qué hacer -- caso real verificado el 2026-09-09 (RUT anonimizado en los tests).
518
+ if (r2.body.includes('Cambiar clave') || r2.body.includes('01.01.215.500.473')) {
519
+ const errNoHabilitado = new Error(
520
+ 'SiiPortalAuth: el certificado no está habilitado como método de autenticación en el SII.\n' +
521
+ 'El contribuyente debe entrar a sii.cl, Clave Tributaria, Cambiar clave, habilitar ' +
522
+ 'autenticación con Certificado Digital, y asociar este certificado. No se resuelve reintentando.'
523
+ );
524
+ errNoHabilitado.code = 'CERTIFICADO_NO_HABILITADO';
525
+ throw errNoHabilitado;
526
+ }
527
+
513
528
  const autenticado = Object.keys(cookieJar).some(k => k.startsWith('NETSCAPE_LIVEWIRE'));
514
529
  if (!autenticado) {
515
530
  throw new Error('SiiPortalAuth: autenticación fallida — no se recibieron cookies de sesión NETSCAPE_LIVEWIRE.*');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlas/dte-sii",
3
- "version": "2.21.1",
3
+ "version": "2.22.0",
4
4
  "description": "Facturación y boletas electrónicas para el SII de Chile. Genera, timbra, firma y envía DTEs, libros electrónicos y automatiza la certificación.",
5
5
  "main": "index.js",
6
6
  "types": "dte-sii.d.ts",