
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
verifactu-tools
Advanced tools
Herramientas para Verifactu: generación de tipos, cliente SOAP y validación XML
Librería de utilidades para trabajar con VeriFactu (AEAT) desde Node.js y TypeScript.
Incluye:
schemaLocation) y trabajar completamente en local.verifactu-tools/
├── wsdl/ # WSDL + XSD descargados desde AEAT
├── src/generated/ # Código generado por wsdl-tsclient
├── test/ # Pruebas unitarias y fixtures
├── scripts/ # Scripts auxiliares para parcheo y codegen
├── package.json
└── tsconfig.json
npm install
npm run codegen
Este comando:
schemaLocation en los .xsdwsdl-tsclient para generar cliente y tipos TypeScriptRequiere que el archivo
xmldsig-core-schema.xsdesté disponible en./wsdl.
npm test
Ejecuta validaciones como:
SuministroLR.xsd, RespuestaSuministro.xsd, etc.La librería usa libxmljs2 para validar que los XML que se generen manualmente cumplan los esquemas definidos por AEAT.
Ejemplo:
const xmlDoc = libxmljs.parseXml(xml);
const xsdDoc = libxmljs.parseXml(fs.readFileSync('wsdl/SuministroLR.xsd'));
const valid = xmlDoc.validate(xsdDoc);
| Comando | Descripción |
|---|---|
npm run patch-xsd | Corrige los schemaLocation en los .xsd |
npm run codegen | Parches + genera cliente y tipos desde WSDL |
npm test | Ejecuta las pruebas de validación XML |
xmldsig-core-schema.xsd de W3Cimport { getVerifactuClient } from 'verifactu-tools';
(async () => {
// Puedes crear el cliente sin enviar nada, útil para generar XML
const client = await getVerifactuClient();
const input = {
Cabecera: {
IDVersionSii: '1.1',
Titular: {
NombreRazon: 'Empresa de Prueba S.L.',
NIF: 'B12345678'
}
},
RegistroAlta: [ ... ]
};
const xml = client.wsdl.objectToXML(
{ SuministroLR: input },
'SuministroLR',
'sf',
'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/sii/ws/SuministroFactEmitidas/v1.1/wsSuministroFactEmitidas.wsdl',
true
);
console.log(xml);
})();
## Generar XML desde JSON
```ts
import { generarXMLDesdeJson } from 'verifactu-tools';
const input = {
Cabecera: {
IDVersionSii: '1.1',
Titular: {
NombreRazon: 'Empresa de Prueba S.L.',
NIF: 'B12345678'
}
},
RegistroAlta: [ ... ]
};
const xml = await generarXMLDesdeJson(input);
console.log(xml);
Puedes ejecutar scripts incluidos en esta librería directamente desde terminal usando tsx. Esto es últil para realizar pruebas manuales sin necesidad de montar código adicional o para recoger la última línea desde otro software.
⚠️ Requiere tener instalado
tsxglobalmente o usarnpx.
Instalación recomendada:
npm install -g tsx
.pfxverifactu-tools-hash <tipo> '<json>'
tipo: alta o anulacionjson: Objeto con los campos requeridosEjemplo:
verifactu-tools-hash anulacion '{"IDEmisorFacturaAnulada":"89890001K","NumSerieFacturaAnulada":"12345679/G34","FechaExpedicionFacturaAnulada":"01-01-2024","Huella":"F7B94CFD8924EDFF273501B01EE5153E4CE8F259766F88CF6ACB8935802A2B97","FechaHoraHusoGenRegistro":"2024-01-01T19:20:40+01:00"}'
verifactu-tools-registrar <cert.pfx> <passphrase> <endpoint> '<json>' [verbose]
Ejemplo:
verifactu-tools-registrar ./certs/cert.pfx 1234 https://prewww2.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP '{
"Cabecera": {
"ObligadoEmision": {
"NombreRazon": "Empresa Test S.L.",
"NIF": "89890001K"
}
},
"RegistroFactura": [{
"RegistroAlta": {
"IDFactura": {
"IDEmisorFactura": "89890001K",
"NumSerieFactura": "12345678/G33",
"FechaExpedicionFactura": "01-01-2024"
},
"TipoFactura": "F1",
"DescripcionOperacion": "Servicio de prueba AEAT",
"CuotaTotal": "12.35",
"ImporteTotal": "123.45",
"SistemaInformatico": {
"NombreSistemaInformatico": "verifactu-tools",
"Version": "1.0.8"
},
"FechaHoraHusoGenRegistro": "2024-01-01T19:20:30+01:00",
"TipoHuella": "01"
}
}]
}' true
verifactu-tools-consultar <cert.pfx> <passphrase> <endpoint> [nif] [desde] [hasta] [verbose]
Ejemplo:
verifactu-tools-consultar ./certs/cert.pfx 1234 https://prewww2.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP B12345678 2025-07-01 2025-09-28 true
MIT
FAQs
Herramientas para Verifactu: generación de tipos, cliente SOAP y validación XML
The npm package verifactu-tools receives a total of 6 weekly downloads. As such, verifactu-tools popularity was classified as not popular.
We found that verifactu-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.