1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! # 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
//!
//! ```rust
//! 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)
//!
//! ```rust
//! 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)
//!
//! ```rust
//! 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);
//! ```
use OnceLock;
/// Global registry for bank accounts.
/// Provides methods to generate, validate, and format bank account numbers.
/// Global registry for personal IDs.
/// Provides methods to generate, validate, and parse national ID numbers (SSN, CPF, Aadhaar, etc.).
/// Global registry for credit cards.
/// Provides methods to generate and validate credit card numbers for major brands (Visa, Mastercard, Amex, etc.).
/// Global registry for company IDs.
/// Provides methods to generate and validate business identifiers (VAT, EIN, CIF) for all countries.
/// Global registry for SWIFT codes.
/// Provides methods to generate and validate 8 and 11 character SWIFT/BIC codes.
/// Global registry for driver's licenses.
/// Provides methods to generate and validate driver's license numbers for all countries.
/// Global registry for tax IDs.
/// Provides methods to generate and validate tax identification numbers (PAN, TIN, etc.) for all countries.
/// Global registry for LEI (Legal Entity Identifier) codes.
/// Provides methods to generate and validate ISO 17442 LEI codes.
/// Global registry for passport numbers.
/// Provides methods to generate and validate passport numbers for all countries.
/// Global registry for VAT numbers.
/// Provides methods to generate and validate EU VAT identification numbers.