How snaven10/gofirmadordte-sv works
Firmador is a Go HTTP service for signing El Salvador electronic tax documents (DTEs). A client submits a document, NIT, and password; the handler loads that NIT’s certificate file, validates the password, decodes and checks its RSA private key, serializes the DTE JSON, and returns a compact JWS or an error response. Signing and response construction are separate internal layers. The sampled source shows these calls; certificate files and clients are external to the repository.
Main entry points: main.go Signing handler · response.go Response builder · certificado.go Request model · CertificadoMH.go Certificate model
Components 12
HTTP API
- HTTP server
main.go - Signing handler
main.go - Request model
models/certificado.go - Response builder
response/response.go
Credentials
- Certificate file
- Certificate loader
main.go - Certificate model
models/CertificadoMH.go - Password validation
main.go
Signing
- Signing coordinator
main.go - RSA key parser
keyprocessing/keyprocessing.go - JWS signer
jwsutils/jwsutils.go
Other components
- DTE client
Connections 12
- DTE client → HTTP server: submits request
main.go - HTTP server → Signing handler: routes POST
main.go - Signing handler → Request model: binds JSON
main.go - Signing handler → Certificate loader: loads certificate
main.go - Certificate loader → Certificate file: reads file
main.go - Certificate loader → Certificate model: parses XML
main.go - Signing handler → Password validation: checks password
main.go - Signing handler → Signing coordinator: signs DTE
main.go - Signing coordinator → RSA key parser: parses private key
main.go - Signing coordinator → JWS signer: creates JWS
main.go - Signing handler → Response builder: builds response
main.go - Response builder → DTE client: returns result