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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zatca-xml-js

v0.1.9

Published

An implementation of Saudi Arabia ZATCA's E-Invoicing requirements, processes, and standards.

Downloads

130

Readme

GitHub license

Dependencies

If you plan on using the built in EGS module to generate keys, and CSR. The EGS module in the package is dependent on OpenSSL being installed in the system it's running on. It's being used to generate an ECDSA key pair using the secp256k1 curve. also to generate and sign a CSR.

All other parts of the package will work fine without OpenSSL. (meaning it supports react-native and other frameworks)

Supports

All tha main futures required to on-board a new EGS. Create, sign, and report a simplified tax invoice are currently supported.

  • EGS (E-Invoice Generation System).
    • Creation/on-boarding (Compliance and Production x.509 CSIDs).
    • Cryptographic stamps generation.
  • Simplified Tax Invoice.
    • Creation.
    • Signing.
    • Compliance checking.
    • Reporting.

Installation

npm install zatca-xml-js

Usage

View full example at examples

import {
    EGS, EGSUnitInfo,
    ZATCASimplifiedTaxInvoice,
} from "zatca-xml-js";


// New Invoice and EGS Unit
const invoice: ZATCASimplifiedTaxInvoice = {/*...*/};
const egsunit: EGSUnitInfo = {/*...*/};

// Init EGS unit
const egs = new EGS(egsunit);
// New Keys & CSR for the EGS
await egs.generateNewKeysAndCSR(false, "solution_name");
// Issue a new compliance cert for the EGS
const compliance_rid = await egs.issueComplianceCertificate("123345");
// Sign invoice
const {signed_invoice_string, invoice_hash} = egs.signInvoice(invoice);
// Check invoice compliance
await egs.checkInvoiceCompliance(signed_invoice_string, invoice_hash);
// Issue production certificate
await egs.issueProductionCertificate(compliance_rid);
// Report invoice
await egs.reportInvoice(signed_invoice_string, invoice_hash);

Implementation

  • General implementation (More details)
    • KSA Rules & Business
    • UBL 2.1 Spec
    • ISO EN16931
    • UN/CEFACT Code List 1001
    • ISO 3166
    • ISO 4217:2015
    • UN/CEFACT Code List 5305, D.16B
  • Security standards (More details)
    • NCA National Cryptographic Standards (NCS - 1 : 2020)
    • NCDC Digital Signing Policy (Version 1.1: 2020)
    • ETSI EN 319 102-1
    • ETSI EN 319 132-1
    • ETSI EN 319 142-1
    • W3C XML-Signature Syntax and Processing
    • ETSI EN 319 122-1
    • IETF RFC 5035 (2007)
    • RFC 5280
    • ISO 32000-1
    • IETF RFC 5652 (2009)
    • RFP6749
    • NIST SP 56A

Notice of Non-Affiliation and Disclaimer

zatca-xml-js is not affiliated, associated, authorized, endorsed by, or in any way officially connected with ZATCA (Zakat, Tax and Customs Authority), or any of its subsidiaries or its affiliates. The official ZATCA website can be found at https://zatca.gov.sa.

Contribution

All contributions are appreciated.

Roadmap

  • CSIDs renewal, revoking.
  • Populating templates using a template engine instead of replace
  • Getting ZATCA to hopefully minify the XMLs before hashing ?

I'm not planning on supporting Tax Invoices (Not simplified ones). If any one wants to tackle that part.