vat_id_validator 0.1.0

A comprehensive library for validating VAT numbers, including format and checksum verification for 30+ countries.
Documentation
  • Coverage
  • 0%
    0 out of 89 items documented0 out of 45 items with examples
  • Size
  • Source code size: 141.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 13.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 30s Average build duration of successful builds.
  • all releases: 30s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • roksprogar

vat_id_validator

vat_id_validator

Validate VAT numbers offline with mathematical precision.

Many libraries only check if a VAT number looks right (regex). vat_id_validator checks if it is right.

It verifies the checksum of the VAT number using country-specific algorithms (Luhn, Modulo 97, weighted sums, etc.). This means you can catch typos, transposed digits, and fake numbers instantly, without making a single network request to flaky government APIs like VIES.

Key Benefits

  • ⚡ Instant & Offline: Zero network latency. No VIES downtime. Works everywhere.
  • 🧮 Mathematical Verification: Catches invalid numbers that regex would pass (e.g., typos).
  • 🛡️ Type-Safe Rust: Built for speed and reliability.
  • 🌍 Multi-Country: Supports 30+ countries including EU, UK, Norway, Switzerland, Serbia, Russia, and Brazil.

Installation

Add this to your Cargo.toml:

[dependencies]
vat_id_validator = "0.1.0"

Usage

use vat_id_validator::check_vat;

fn main() {
    // Valid UK VAT number
    assert!(check_vat("GB999999973"));

    // Invalid format
    assert!(!check_vat("GB123"));

    // Valid format but invalid checksum
    assert!(!check_vat("GB999999974"));
}

Supported Countries

  • Andorra (AD)
  • Austria (AT)
  • Belgium (BE)
  • Brazil (BR)
  • Bulgaria (BG)
  • Croatia (HR)
  • Cyprus (CY)
  • Czech Republic (CZ)
  • Denmark (DK)
  • Estonia (EE)
  • Finland (FI)
  • France (FR)
  • Germany (DE)
  • Greece (GR)
  • Hungary (HU)
  • Ireland (IE)
  • Italy (IT)
  • Latvia (LV)
  • Lithuania (LT)
  • Luxembourg (LU)
  • Malta (MT)
  • Netherlands (NL)
  • Norway (NO)
  • Poland (PL)
  • Portugal (PT)
  • Romania (RO)
  • Russia (RU)
  • Serbia (RS)
  • Slovakia (SK)
  • Slovenia (SI)
  • Spain (ES)
  • Sweden (SE)
  • Switzerland (CH)
  • United Kingdom (GB)

License

MIT / Apache-2.0