dgii-ecf
English · Español
Electronic invoicing (e-CF) SDKs for the Dominican Republic’s DGII —
Dirección General de Impuestos Internos.

Professional, polyglot monorepo with two publishable, production-oriented SDKs
for authenticating against DGII web services, signing electronic tax documents
with XMLDSig (inclusive C14N + RSA-SHA256), and transmitting them reliably.
✨ Features
Both SDKs share the same design contract:
- Result pattern — no hidden exceptions. TypeScript uses
neverthrow; Python uses
result.
- Resilience built-in — retry + circuit breaker + timeout for every external
call. TypeScript uses
cockatiel;
Python uses tenacity +
pybreaker.
- Idempotent submission — injectable
IdempotencyStore, keyed by
RNC + eNCF + SHA-256(signed XML), so a retried send never double-issues.
- Correct XMLDSig — inclusive C14N 1.0, enveloped signature, RSA-SHA256,
byte-for-byte compatible with DGII’s
.NET stack.
- Full API surface — authentication (SEED), document submission, summary
invoices (RFCE), status/track-id queries, service status, customer and general
directories, commercial approval, e-NCF voiding, and reconciliation of a
pending submission.
- Pre-flight checks — bundled-schema validation (TypeScript shells out to
xmllint, Python uses lxml) and a maintenance-window check before a batch.
- Money as
Decimal — floating-point rounding can never corrupt a digest.
📦 Layout
packages/
├── typescript/ # @deuriib/dgii-ecf — bun, tsup, vitest, native fetch
└── python/ # py-dgii-ecf — uv, ruff, mypy, typer, httpx2
🚀 Quick start
TypeScript
bun add @deuriib/dgii-ecf
import { ECF, P12Reader, Signature, Environment } from '@deuriib/dgii-ecf';
const { key, cert } = new P12Reader(process.env.CERT_PASSWORD!)
.getKeyFromFile('/secure/identity.p12')
.unwrapOrThrow(); // or .match(...)
const ecf = new ECF({ key, cert }, Environment.Cert);
const auth = await ecf.authenticate(); // Result<AuthToken, DgiiError>
const signed = new Signature(key, cert).signXml(xml); // Result<string, DgiiError>
Python
uv add py-dgii-ecf
from py_dgii_ecf import ECF, P12Reader, Signature, Environment
data = P12Reader(password).get_key_from_file("/secure/identity.p12").unwrap_or_raise()
ecf = ECF(data, Environment.CERT)
auth = ecf.authenticate() # Ok(AuthToken) | Err(DgiiError)
signed = Signature(data.key, data.cert).sign_xml(xml)
⚠️ Server-side only. Never load these SDKs in a browser — they handle private
keys and credentials.
🧪 Development & release
See CONTRIBUTING.md for the full workflow.
📚 Documentation
⚖️ License
MIT © 2026 Deuri Vasquez.
This project is not affiliated with the DGII. It is an independent, community
implementation of the public e-CF technical specification (Ley 32-23 and
Decreto 587-24). Always validate against the official
DGII documentation.
评论