Crate idsmith

Crate idsmith 

Source
Expand description

§idsmith

Validate and generate checksum-correct IBANs, personal IDs, bank accounts, credit cards, SWIFT/BIC, company IDs, driver’s licenses, tax IDs, passports, LEI codes, and EU VAT numbers. Every identifier passes mod-97 (IBAN) and national checksum validation.

§Quick Start

use rand::thread_rng;
use idsmith::{iban, personal_id};

let mut rng = thread_rng();

// Generate a German IBAN
let code = iban::generate_iban(Some("DE"), &mut rng).unwrap();
println!("{}", iban::format_iban(&code));

// Generate an Estonian personal ID
let registry = personal_id::Registry::new();
let opts = personal_id::GenOptions::default();
let id = registry.generate("EE", &opts, &mut rng).unwrap();
println!("{}", id);

§idsmith

A comprehensive Generator and Validator for valid, checksum-correct identifiers. Supports IBANs, Personal IDs, Bank Accounts, Credit Cards, SWIFT/BIC, Company IDs, Driver’s Licenses, Tax IDs, Passports, LEI codes, and EU VAT numbers.

§Quick Start (Generation)

use rand::thread_rng;
use idsmith::{bank_accounts, personal_ids};

let mut rng = thread_rng();

// Generate a German IBAN
let code = idsmith::iban::generate_iban(Some("DE"), &mut rng).unwrap();

// Generate an Estonian personal ID
let id = personal_ids().generate("EE", &Default::default(), &mut rng).unwrap();

§Quick Start (Validation)

use idsmith::{credit_cards, personal_ids};

// Validate a credit card number
let is_valid = credit_cards().validate("4152839405126374");

// Validate a US Social Security Number
let is_ssn_valid = personal_ids().validate("US", "446-72-2445").unwrap_or(false);

Modules§

bank_account
company_id
countries
Centralized registry of ISO 3166-1 alpha-2 country codes and names. This list covers 250+ countries and territories supported by the library.
credit_card
csv
Optional CSV formatting for IBAN and personal ID results.
driver_license
iban
lei
passport
personal_id
swift
tax_id
vat

Functions§

bank_accounts
Global registry for bank accounts. Provides methods to generate, validate, and format bank account numbers.
company_ids
Global registry for company IDs. Provides methods to generate and validate business identifiers (VAT, EIN, CIF) for all countries.
credit_cards
Global registry for credit cards. Provides methods to generate and validate credit card numbers for major brands (Visa, Mastercard, Amex, etc.).
driver_licenses
Global registry for driver’s licenses. Provides methods to generate and validate driver’s license numbers for all countries.
lei_codes
Global registry for LEI (Legal Entity Identifier) codes. Provides methods to generate and validate ISO 17442 LEI codes.
passports
Global registry for passport numbers. Provides methods to generate and validate passport numbers for all countries.
personal_ids
Global registry for personal IDs. Provides methods to generate, validate, and parse national ID numbers (SSN, CPF, Aadhaar, etc.).
swift_codes
Global registry for SWIFT codes. Provides methods to generate and validate 8 and 11 character SWIFT/BIC codes.
tax_ids
Global registry for tax IDs. Provides methods to generate and validate tax identification numbers (PAN, TIN, etc.) for all countries.
vat_ids
Global registry for VAT numbers. Provides methods to generate and validate EU VAT identification numbers.