anonyma 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,754 @@
1
+ import { e as PiiMatch, l as DetectorRegistry } from '../types-D-9HzVuy.cjs';
2
+
3
+ /**
4
+ * @module detectors/email
5
+ * @description Detector for email addresses.
6
+ */
7
+
8
+ /**
9
+ * Detect email addresses in `text`.
10
+ *
11
+ * @param text - The input string to scan.
12
+ * @returns An array of {@link PiiMatch} objects with `category: "email"`.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { detectEmail } from "anonyma/detectors";
17
+ *
18
+ * detectEmail("Contact us at support@example.com.");
19
+ * // [{ category: "email", value: "support@example.com", start: 14, end: 33, confidence: 0.99 }]
20
+ * ```
21
+ */
22
+ declare function detectEmail(text: string): PiiMatch[];
23
+ /**
24
+ * Aggressive variant of {@link detectEmail}.
25
+ *
26
+ * Catches obfuscated email formats such as `user [at] domain [dot] com` and
27
+ * `user(at)domain(dot)com` in addition to standard RFC addresses.
28
+ * Deduplicates results so a valid standard address isn't reported twice.
29
+ *
30
+ * Confidence is `0.75` for obfuscated matches, `0.99` for standard matches.
31
+ *
32
+ * @param text - The input string to scan.
33
+ * @returns An array of {@link PiiMatch} objects with `category: "email"`.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { detectEmailAggressive } from "anonyma/detectors";
38
+ *
39
+ * detectEmailAggressive("Email user [at] example [dot] com for help.");
40
+ * // [{ category: "email", value: "user [at] example [dot] com", confidence: 0.75, ... }]
41
+ * ```
42
+ */
43
+ declare function detectEmailAggressive(text: string): PiiMatch[];
44
+
45
+ /**
46
+ * @module detectors/phone
47
+ * @description Detector for phone numbers (international and North American formats).
48
+ */
49
+
50
+ /**
51
+ * Detect phone numbers in `text`.
52
+ *
53
+ * @param text - The input string to scan.
54
+ * @returns An array of {@link PiiMatch} objects with `category: "phone"`.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import { detectPhone } from "anonyma/detectors";
59
+ *
60
+ * detectPhone("Call me at +1 (555) 867-5309.");
61
+ * // [{ category: "phone", value: "+1 (555) 867-5309", start: 11, end: 28, confidence: 0.9 }]
62
+ * ```
63
+ */
64
+ declare function detectPhone(text: string): PiiMatch[];
65
+ /**
66
+ * Aggressive variant of {@link detectPhone}.
67
+ *
68
+ * In addition to standard formats, also catches 7-digit local numbers such as
69
+ * `555-1234`. Confidence is `0.7` for 7-digit matches due to higher false-positive risk.
70
+ *
71
+ * @param text - The input string to scan.
72
+ * @returns An array of {@link PiiMatch} objects with `category: "phone"`.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * import { detectPhoneAggressive } from "anonyma/detectors";
77
+ *
78
+ * detectPhoneAggressive("Call 555-1234 for info.");
79
+ * // [{ category: "phone", value: "555-1234", confidence: 0.7, ... }]
80
+ * ```
81
+ */
82
+ declare function detectPhoneAggressive(text: string): PiiMatch[];
83
+
84
+ /**
85
+ * @module detectors/ssn
86
+ * @description Detector for US Social Security Numbers (SSN).
87
+ */
88
+
89
+ /**
90
+ * Detect US Social Security Numbers in `text`.
91
+ *
92
+ * @param text - The input string to scan.
93
+ * @returns An array of {@link PiiMatch} objects with `category: "ssn"`.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { detectSsn } from "anonyma/detectors";
98
+ *
99
+ * detectSsn("SSN: 123-45-6789");
100
+ * // [{ category: "ssn", value: "123-45-6789", start: 5, end: 16, confidence: 0.95 }]
101
+ * ```
102
+ */
103
+ declare function detectSsn(text: string): PiiMatch[];
104
+ /**
105
+ * Aggressive variant of {@link detectSsn}.
106
+ *
107
+ * Also catches 9-digit SSNs written without separators (e.g. `123456789`).
108
+ * Results from the normal pattern are deduplicated so no match is reported twice.
109
+ *
110
+ * Confidence is `0.8` for no-separator matches due to higher false-positive risk.
111
+ *
112
+ * @param text - The input string to scan.
113
+ * @returns An array of {@link PiiMatch} objects with `category: "ssn"`.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * import { detectSsnAggressive } from "anonyma/detectors";
118
+ *
119
+ * detectSsnAggressive("SSN 123456789 on file.");
120
+ * // [{ category: "ssn", value: "123456789", confidence: 0.8, ... }]
121
+ * ```
122
+ */
123
+ declare function detectSsnAggressive(text: string): PiiMatch[];
124
+
125
+ /**
126
+ * @module detectors/credit-card
127
+ * @description Detector for credit/debit card numbers with Luhn algorithm validation.
128
+ */
129
+
130
+ /**
131
+ * Detect credit/debit card numbers in `text`.
132
+ * Uses the Luhn algorithm to reject invalid sequences.
133
+ *
134
+ * @param text - The input string to scan.
135
+ * @returns An array of {@link PiiMatch} objects with `category: "credit-card"`.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * import { detectCreditCard } from "anonyma/detectors";
140
+ *
141
+ * detectCreditCard("Card: 4111 1111 1111 1111");
142
+ * // [{ category: "credit-card", value: "4111 1111 1111 1111", start: 6, end: 25, confidence: 0.97 }]
143
+ * ```
144
+ */
145
+ declare function detectCreditCard(text: string): PiiMatch[];
146
+ /**
147
+ * Aggressive variant of {@link detectCreditCard}.
148
+ *
149
+ * In addition to Luhn-validated card numbers, also detects masked card formats
150
+ * such as `****-****-****-1234`. Masked cards cannot be Luhn-validated, so
151
+ * confidence is lower (`0.8`).
152
+ *
153
+ * @param text - The input string to scan.
154
+ * @returns An array of {@link PiiMatch} objects with `category: "credit-card"`.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * import { detectCreditCardAggressive } from "anonyma/detectors";
159
+ *
160
+ * detectCreditCardAggressive("Card ending: ****-****-****-1234");
161
+ * // [{ category: "credit-card", value: "****-****-****-1234", confidence: 0.8, ... }]
162
+ * ```
163
+ */
164
+ declare function detectCreditCardAggressive(text: string): PiiMatch[];
165
+
166
+ /**
167
+ * @module detectors/ip-address
168
+ * @description Detectors for IPv4 and IPv6 addresses.
169
+ */
170
+
171
+ /**
172
+ * Detect IPv4 addresses in `text`.
173
+ *
174
+ * @param text - The input string to scan.
175
+ * @returns An array of {@link PiiMatch} objects with `category: "ipv4"`.
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * import { detectIpv4 } from "anonyma/detectors";
180
+ *
181
+ * detectIpv4("Client IP: 192.168.1.100");
182
+ * // [{ category: "ipv4", value: "192.168.1.100", start: 11, end: 24, confidence: 0.98 }]
183
+ * ```
184
+ */
185
+ declare function detectIpv4(text: string): PiiMatch[];
186
+ /**
187
+ * Detect IPv6 addresses in `text`.
188
+ *
189
+ * @param text - The input string to scan.
190
+ * @returns An array of {@link PiiMatch} objects with `category: "ipv6"`.
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * import { detectIpv6 } from "anonyma/detectors";
195
+ *
196
+ * detectIpv6("Address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334");
197
+ * // [{ category: "ipv6", value: "2001:0db8:...", start: 9, end: 47, confidence: 0.98 }]
198
+ * ```
199
+ */
200
+ declare function detectIpv6(text: string): PiiMatch[];
201
+
202
+ /**
203
+ * @module detectors/url
204
+ * @description Detector for URLs (http and https).
205
+ */
206
+
207
+ /**
208
+ * Detect URLs in `text`.
209
+ *
210
+ * Matches `http://` and `https://` URLs. For `ftp://` detection, use `customPatterns`.
211
+ *
212
+ * @param text - The input string to scan.
213
+ * @returns An array of {@link PiiMatch} objects with `category: "url"`.
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * import { detectUrl } from "anonyma/detectors";
218
+ *
219
+ * detectUrl("Visit https://www.example.com/profile?id=42");
220
+ * // [{ category: "url", value: "https://www.example.com/profile?id=42", ... }]
221
+ * ```
222
+ */
223
+ declare function detectUrl(text: string): PiiMatch[];
224
+
225
+ /**
226
+ * @module detectors/iban
227
+ * @description Detector for International Bank Account Numbers (IBAN).
228
+ *
229
+ * IBAN validation follows ISO 13616:
230
+ * 1. Match the basic format (2-letter country code + 2-digit check digits + BBAN).
231
+ * 2. Validate via MOD-97 check as per the ISO standard.
232
+ */
233
+
234
+ /**
235
+ * Detect IBAN (International Bank Account Number) strings in `text`.
236
+ * Only matches that pass the MOD-97 check are included.
237
+ *
238
+ * @param text - The input string to scan.
239
+ * @returns An array of {@link PiiMatch} objects with `category: "iban"`.
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * import { detectIban } from "anonyma/detectors";
244
+ *
245
+ * detectIban("IBAN: GB82 WEST 1234 5698 7654 32");
246
+ * // [{ category: "iban", value: "GB82 WEST 1234 5698 7654 32", start: 6, end: 33, confidence: 0.99 }]
247
+ * ```
248
+ */
249
+ declare function detectIban(text: string): PiiMatch[];
250
+
251
+ /**
252
+ * @module detectors/date-of-birth
253
+ * @description Detector for date-of-birth patterns in common formats.
254
+ *
255
+ * Supported formats:
256
+ * - ISO 8601: 1990-01-15
257
+ * - US short: 01/15/1990, 01-15-1990
258
+ * - European short: 15/01/1990, 15.01.1990
259
+ * - Long-form: January 15, 1990 / 15 January 1990
260
+ */
261
+
262
+ /**
263
+ * Detect date-of-birth patterns in `text`.
264
+ *
265
+ * @param text - The input string to scan.
266
+ * @returns An array of {@link PiiMatch} objects with `category: "date-of-birth"`.
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * import { detectDateOfBirth } from "anonyma/detectors";
271
+ *
272
+ * detectDateOfBirth("DOB: 1990-04-15");
273
+ * // [{ category: "date-of-birth", value: "1990-04-15", start: 5, end: 15, confidence: 0.85 }]
274
+ * ```
275
+ */
276
+ declare function detectDateOfBirth(text: string): PiiMatch[];
277
+
278
+ /**
279
+ * @module detectors/name
280
+ * @description Enhanced heuristic detector for person names.
281
+ *
282
+ * @remarks
283
+ * Detection uses multiple heuristic signals:
284
+ * 1. **Greeting context** — names after "Dear", "Hi", "Hello", etc.
285
+ * 2. **Title prefix** — names after Mr., Mrs., Ms., Dr., Prof., Rev., Hon., Capt., etc.
286
+ * 3. **Context keywords** — names after "patient", "client", "defendant", "applicant",
287
+ * "user", "by", "from", "to", "signed", "authored by", "submitted by", etc.
288
+ *
289
+ * This detector is still heuristic and NOT an NLP-based named-entity recogniser.
290
+ * Confidence is set to reflect the heuristic nature.
291
+ */
292
+
293
+ /**
294
+ * Detect person names preceded by greeting keywords in `text`.
295
+ *
296
+ * @param text - The input string to scan.
297
+ * @returns An array of {@link PiiMatch} objects with `category: "name"`.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * import { detectName } from "anonyma/detectors";
302
+ *
303
+ * detectName("Dear Alice Smith, your account is ready.");
304
+ * // [{ category: "name", value: "Alice Smith", start: 5, end: 16, confidence: 0.75 }]
305
+ * ```
306
+ */
307
+ declare function detectName(text: string): PiiMatch[];
308
+ /**
309
+ * Aggressive variant of {@link detectName}.
310
+ *
311
+ * Uses all detection strategies with reduced confidence to catch more names
312
+ * at the cost of a higher false-positive rate.
313
+ *
314
+ * @param text - The input string to scan.
315
+ * @returns An array of {@link PiiMatch} objects with `category: "name"`.
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { detectNameAggressive } from "anonyma/detectors";
320
+ *
321
+ * detectNameAggressive("Please see Dr. Smith for your appointment.");
322
+ * // [{ category: "name", value: "Smith", confidence: 0.65, ... }]
323
+ * ```
324
+ */
325
+ declare function detectNameAggressive(text: string): PiiMatch[];
326
+
327
+ /**
328
+ * @module detectors/address
329
+ * @description Heuristic detector for physical street addresses (US, UK, EU formats).
330
+ *
331
+ * Detection combines:
332
+ * - Common address context keywords ("address:", "lives at", "ship to", etc.)
333
+ * - US street patterns: number + direction + street name + type
334
+ * - UK postcode patterns
335
+ * - PO Box patterns
336
+ *
337
+ * Confidence: 0.80 (heuristic — high false-negative rate for uncommon formats).
338
+ */
339
+
340
+ /**
341
+ * Detect physical addresses in `text`.
342
+ *
343
+ * @param text - The input string to scan.
344
+ * @returns An array of {@link PiiMatch} objects with `category: "address"`.
345
+ */
346
+ declare function detectAddress(text: string): PiiMatch[];
347
+
348
+ /**
349
+ * @module detectors/passport
350
+ * @description Detector for passport numbers across multiple countries.
351
+ *
352
+ * Supported formats:
353
+ * - US: 1 letter + 8 digits (e.g. A12345678)
354
+ * - UK: 9 digits
355
+ * - EU (generic): 1-2 letters + 6-8 digits
356
+ * - Canada: 2 letters + 6 digits (e.g. AB123456)
357
+ * - Australia: 1 letter + 7 digits (e.g. N1234567)
358
+ *
359
+ * Context keywords ("passport", "passport number", "passport no") boost confidence.
360
+ */
361
+
362
+ /**
363
+ * Detect passport numbers in `text`.
364
+ *
365
+ * @param text - The input string to scan.
366
+ * @returns An array of {@link PiiMatch} objects with `category: "passport"`.
367
+ */
368
+ declare function detectPassport(text: string): PiiMatch[];
369
+
370
+ /**
371
+ * @module detectors/drivers-license
372
+ * @description Detector for driver's license numbers (US, UK DVLA, EU generic).
373
+ *
374
+ * Detection strongly depends on context keywords ("driver's license", "dl#", etc.)
375
+ * to reduce false positives — raw number patterns are too generic.
376
+ *
377
+ * Supported:
378
+ * - US: state-specific patterns (generalised as alphanumeric 5-15 chars)
379
+ * - UK DVLA: SURNAME(5) + DOB(6) + GENDER(1) + NAME_INITIALS(2) + CHECK(2)
380
+ * - EU generic: alphanumeric 8-15 chars after context keyword
381
+ */
382
+
383
+ /**
384
+ * Detect driver's license numbers in `text`.
385
+ *
386
+ * @param text - The input string to scan.
387
+ * @returns An array of {@link PiiMatch} objects with `category: "drivers-license"`.
388
+ */
389
+ declare function detectDriversLicense(text: string): PiiMatch[];
390
+
391
+ /**
392
+ * @module detectors/national-id
393
+ * @description Detector for national identification numbers across 20+ countries.
394
+ *
395
+ * Covered countries/formats:
396
+ * - Canada: SIN (XXX-XXX-XXX)
397
+ * - Mexico: CURP (18 chars alphanumeric) and RFC (13 chars)
398
+ * - UK: NINO (AB 12 34 56 C)
399
+ * - India: Aadhaar (12 digits, verified with format check)
400
+ * - China: Resident ID (18 digits with letter checksum)
401
+ * - South Korea: RRN (XXXXXX-XXXXXXX)
402
+ * - Germany: Personalausweis (9 alphanumeric)
403
+ * - France: NIR/INSEE (15 digits with spaces)
404
+ * - Brazil: CPF (XXX.XXX.XXX-XX)
405
+ * - Argentina: DNI (7-8 digits)
406
+ * - South Africa: ID (13 digits)
407
+ * - Nigeria: NIN (11 digits)
408
+ * - Australia: TFN (XXX XXX XXX)
409
+ * - New Zealand: IRD (XXX-XXX-XXX)
410
+ * - Sweden: Personnummer (XXXXXX-XXXX)
411
+ * - Norway: Fødselsnummer (11 digits)
412
+ * - Netherlands: BSN (9 digits, 11-proef)
413
+ * - Spain: DNI/NIE (8 digits + letter / X+7digits+letter)
414
+ * - Italy: Codice Fiscale (16 alphanumeric)
415
+ * - Portugal: NIF (9 digits)
416
+ * - US: SSN (handled separately by ssn.ts — not duplicated here)
417
+ */
418
+
419
+ /**
420
+ * Detect national identification numbers in `text`.
421
+ *
422
+ * @param text - The input string to scan.
423
+ * @returns An array of {@link PiiMatch} objects with `category: "national-id"`.
424
+ */
425
+ declare function detectNationalId(text: string): PiiMatch[];
426
+
427
+ /**
428
+ * @module detectors/bank-account
429
+ * @description Detector for bank account numbers and routing information.
430
+ *
431
+ * Covered formats:
432
+ * - US: ABA routing number (9 digits with specific prefix ranges) + account numbers
433
+ * - UK: Sort code (XX-XX-XX) + 8-digit account number
434
+ * - SWIFT/BIC codes (8 or 11 chars)
435
+ *
436
+ * Context keywords are essential for reducing false positives.
437
+ */
438
+
439
+ /**
440
+ * Detect bank account numbers and related identifiers in `text`.
441
+ *
442
+ * @param text - The input string to scan.
443
+ * @returns An array of {@link PiiMatch} objects with `category: "bank-account"`.
444
+ */
445
+ declare function detectBankAccount(text: string): PiiMatch[];
446
+
447
+ /**
448
+ * @module detectors/cryptocurrency
449
+ * @description Detector for cryptocurrency wallet addresses.
450
+ *
451
+ * Covered:
452
+ * - Bitcoin: Legacy (1...), P2SH (3...), Bech32 (bc1...)
453
+ * - Ethereum / EVM: 0x + 40 hex chars
454
+ * - Litecoin: L... or M... (34-35 chars)
455
+ * - Monero: 4... (95 chars)
456
+ * - Ripple/XRP: r... (25-34 alphanumeric)
457
+ * - Solana: Base58 44-45 chars
458
+ * - Cardano: addr1... (58-103 chars)
459
+ */
460
+
461
+ /**
462
+ * Detect cryptocurrency wallet addresses in `text`.
463
+ *
464
+ * @param text - The input string to scan.
465
+ * @returns An array of {@link PiiMatch} objects with `category: "cryptocurrency"`.
466
+ */
467
+ declare function detectCryptocurrency(text: string): PiiMatch[];
468
+
469
+ /**
470
+ * @module detectors/tax-id
471
+ * @description Detector for tax identification numbers.
472
+ *
473
+ * Covered:
474
+ * - US EIN: XX-XXXXXXX
475
+ * - US ITIN: 9XX-XX-XXXX (where second group is 50-65, 70-88, 90-92, 94-99)
476
+ * - UK UTR: 10 digits (Unique Taxpayer Reference)
477
+ * - EU VAT numbers: country prefix + digits/letters
478
+ * - Australia TFN: XXX XXX XXX (shared with national-id, context disambiguates)
479
+ * - Australia ABN: 11 digits XX XXX XXX XXX
480
+ */
481
+
482
+ /**
483
+ * Detect tax identification numbers in `text`.
484
+ *
485
+ * @param text - The input string to scan.
486
+ * @returns An array of {@link PiiMatch} objects with `category: "tax-id"`.
487
+ */
488
+ declare function detectTaxId(text: string): PiiMatch[];
489
+
490
+ /**
491
+ * @module detectors/medical-record
492
+ * @description Detector for medical record numbers and healthcare provider identifiers.
493
+ *
494
+ * Covered:
495
+ * - MRN (Medical Record Number): various alphanumeric formats with context keyword
496
+ * - US NPI (National Provider Identifier): 10 digits, Luhn-valid, prefix 80840
497
+ * - DEA registration numbers: 2 letters + 7 digits with checksum validation
498
+ */
499
+
500
+ /**
501
+ * Detect medical record numbers, NPI numbers, and DEA numbers in `text`.
502
+ *
503
+ * @param text - The input string to scan.
504
+ * @returns An array of {@link PiiMatch} objects with `category: "medical-record"`.
505
+ */
506
+ declare function detectMedicalRecord(text: string): PiiMatch[];
507
+
508
+ /**
509
+ * @module detectors/health-insurance
510
+ * @description Detector for health insurance identifiers.
511
+ *
512
+ * Covered:
513
+ * - US Medicare Beneficiary Identifier (MBI): alphanumeric 11 chars
514
+ * - US Medicaid: state-specific formats (alphanumeric, context required)
515
+ * - UK NHS numbers: 10 digits with mod-11 validation
516
+ * - EU EHIC (European Health Insurance Card): country code + series + personal ID
517
+ */
518
+
519
+ /**
520
+ * Detect health insurance identifiers in `text`.
521
+ *
522
+ * @param text - The input string to scan.
523
+ * @returns An array of {@link PiiMatch} objects with `category: "health-insurance"`.
524
+ */
525
+ declare function detectHealthInsurance(text: string): PiiMatch[];
526
+
527
+ /**
528
+ * @module detectors/prescription
529
+ * @description Detector for prescription and pharmaceutical identifiers.
530
+ *
531
+ * Covered:
532
+ * - DEA registration numbers (with checksum)
533
+ * - NDC (National Drug Code): 10-11 digit codes in various formats
534
+ * - Rx (prescription) numbers: numeric identifiers with context keywords
535
+ */
536
+
537
+ /**
538
+ * Detect prescription identifiers in `text`.
539
+ *
540
+ * @param text - The input string to scan.
541
+ * @returns An array of {@link PiiMatch} objects with `category: "prescription"`.
542
+ */
543
+ declare function detectPrescription(text: string): PiiMatch[];
544
+
545
+ /**
546
+ * @module detectors/api-key
547
+ * @description Detector for API keys and authentication tokens.
548
+ *
549
+ * Covered formats:
550
+ * - AWS Access Key ID: AKIA... (20 chars)
551
+ * - AWS Secret Access Key: 40 base64 chars (context required)
552
+ * - Stripe live secret key: sk_live_...
553
+ * - Stripe live publishable key: pk_live_...
554
+ * - Stripe test keys: sk_test_..., pk_test_...
555
+ * - GitHub tokens: ghp_, gho_, ghs_, ghr_, github_pat_
556
+ * - Slack bot token: xoxb-...
557
+ * - Slack user token: xoxp-...
558
+ * - Slack app token: xoxa-...
559
+ * - Slack workspace token: xoxs-...
560
+ * - OpenAI API key: sk-...
561
+ * - Google API key: AIza...
562
+ * - JWT tokens: eyJ...
563
+ * - Bearer tokens: Bearer + base64 string (context required)
564
+ * - Generic API key with context keyword
565
+ */
566
+
567
+ /**
568
+ * Detect API keys and authentication tokens in `text`.
569
+ *
570
+ * @param text - The input string to scan.
571
+ * @returns An array of {@link PiiMatch} objects with `category: "api-key"`.
572
+ */
573
+ declare function detectApiKey(text: string): PiiMatch[];
574
+
575
+ /**
576
+ * @module detectors/social-media
577
+ * @description Detector for social media identifiers and handles.
578
+ *
579
+ * Covered:
580
+ * - Twitter/X handles: @username (1-15 alphanumeric/underscore)
581
+ * - Instagram handles: @username (1-30 alphanumeric/underscore/period)
582
+ * - Discord IDs: 17-19 digit snowflake IDs
583
+ * - YouTube channel IDs: UC + 22 base64 chars
584
+ * - TikTok handles: @username
585
+ * - LinkedIn profile URLs: linkedin.com/in/...
586
+ * - Reddit usernames: u/username
587
+ */
588
+
589
+ /**
590
+ * Detect social media identifiers in `text`.
591
+ *
592
+ * @param text - The input string to scan.
593
+ * @returns An array of {@link PiiMatch} objects with `category: "social-media"`.
594
+ */
595
+ declare function detectSocialMedia(text: string): PiiMatch[];
596
+
597
+ /**
598
+ * @module detectors/vin
599
+ * @description Detector for Vehicle Identification Numbers (VIN).
600
+ *
601
+ * VINs are 17 characters per ISO 3779. The 9th character is a check digit
602
+ * validated using transliteration and a mod-11 algorithm. Characters I, O, Q
603
+ * are excluded from valid VINs.
604
+ *
605
+ * Confidence: 0.95 when checksum passes, 0.70 for format-only match.
606
+ */
607
+
608
+ /**
609
+ * Detect Vehicle Identification Numbers in `text`.
610
+ *
611
+ * @param text - The input string to scan.
612
+ * @returns An array of {@link PiiMatch} objects with `category: "vin"`.
613
+ */
614
+ declare function detectVin(text: string): PiiMatch[];
615
+ /**
616
+ * Aggressive variant of {@link detectVin}.
617
+ * Also reports format-valid VINs that fail the checksum (e.g. non-North-American
618
+ * vehicles where the check digit is not enforced).
619
+ *
620
+ * @param text - The input string to scan.
621
+ * @returns An array of {@link PiiMatch} objects with `category: "vin"`.
622
+ */
623
+ declare function detectVinAggressive(text: string): PiiMatch[];
624
+
625
+ /**
626
+ * @module detectors/license-plate
627
+ * @description Detector for vehicle license/number plates.
628
+ *
629
+ * Covered formats:
630
+ * - US: generic state format (2-8 alphanumeric, context required)
631
+ * - UK: current format (AB12 ABC) and older (A123 BCD)
632
+ * - EU generic: 1-2 letters + 2-4 digits + 1-3 letters
633
+ *
634
+ * Context keywords strongly boost reliability.
635
+ */
636
+
637
+ /**
638
+ * Detect vehicle license plate numbers in `text`.
639
+ *
640
+ * @param text - The input string to scan.
641
+ * @returns An array of {@link PiiMatch} objects with `category: "license-plate"`.
642
+ */
643
+ declare function detectLicensePlate(text: string): PiiMatch[];
644
+
645
+ /**
646
+ * @module detectors/tracking-number
647
+ * @description Detector for parcel/shipment tracking numbers.
648
+ *
649
+ * Covered carriers:
650
+ * - FedEx: 12 or 15 or 20 digits
651
+ * - UPS: 1Z + 16 chars
652
+ * - USPS: 20-22 digits or XX### ### ### US format
653
+ * - DHL: 10 digits or 11 digits starting with JD
654
+ * - Amazon: TBA + 12 digits
655
+ */
656
+
657
+ /**
658
+ * Detect parcel tracking numbers in `text`.
659
+ *
660
+ * @param text - The input string to scan.
661
+ * @returns An array of {@link PiiMatch} objects with `category: "tracking-number"`.
662
+ */
663
+ declare function detectTrackingNumber(text: string): PiiMatch[];
664
+
665
+ /**
666
+ * @module detectors/case-number
667
+ * @description Detector for US federal/state court case numbers.
668
+ *
669
+ * US federal court case numbers follow the pattern:
670
+ * - YEAR:COURT DIVISION - CASE_TYPE - NUMBER (e.g., 1:21-cv-00123)
671
+ * - Or: YEAR-CASE_TYPE-NUMBER (e.g., 21-CR-0456)
672
+ *
673
+ * Requires context keywords to reduce false positives.
674
+ */
675
+
676
+ /**
677
+ * Detect court case numbers in `text`.
678
+ *
679
+ * @param text - The input string to scan.
680
+ * @returns An array of {@link PiiMatch} objects with `category: "case-number"`.
681
+ */
682
+ declare function detectCaseNumber(text: string): PiiMatch[];
683
+
684
+ /**
685
+ * @module detectors/company-registration
686
+ * @description Detector for company registration numbers.
687
+ *
688
+ * Covered:
689
+ * - US EIN: XX-XXXXXXX (same as tax-id but in company registration context)
690
+ * - UK Companies House: 8 digits or 2 letters + 6 digits (e.g., 00123456, SC012345)
691
+ * - EU/generic: country code + alphanumeric registration number
692
+ * - Australian ACN: XXX XXX XXX (9 digits)
693
+ */
694
+
695
+ /**
696
+ * Detect company registration numbers in `text`.
697
+ *
698
+ * @param text - The input string to scan.
699
+ * @returns An array of {@link PiiMatch} objects with `category: "company-registration"`.
700
+ */
701
+ declare function detectCompanyRegistration(text: string): PiiMatch[];
702
+
703
+ /**
704
+ * @module detectors
705
+ * @description Barrel export for all built-in PII detectors.
706
+ *
707
+ * Each detector is a pure function that accepts a string and returns an array of
708
+ * {@link PiiMatch} objects. Import individual detectors for maximum tree-shaking,
709
+ * or use the pre-assembled {@link DETECTOR_REGISTRY} for convenience.
710
+ *
711
+ * For aggressive (more permissive) detection, use {@link AGGRESSIVE_DETECTOR_REGISTRY}.
712
+ *
713
+ * @example
714
+ * ```ts
715
+ * import { detectEmail, detectPhone, DETECTOR_REGISTRY } from "anonyma/detectors";
716
+ *
717
+ * // Use a single detector:
718
+ * const matches = detectEmail("hello@example.com");
719
+ *
720
+ * // Or scan for everything:
721
+ * const allMatches = Object.values(DETECTOR_REGISTRY).flatMap((d) => d("some text"));
722
+ * ```
723
+ */
724
+
725
+ /**
726
+ * A pre-assembled registry containing all built-in detectors, keyed by
727
+ * {@link PiiCategory}.
728
+ *
729
+ * @example
730
+ * ```ts
731
+ * import { DETECTOR_REGISTRY } from "anonyma/detectors";
732
+ *
733
+ * const emailMatches = DETECTOR_REGISTRY.email("user@example.com");
734
+ * ```
735
+ */
736
+ declare const DETECTOR_REGISTRY: DetectorRegistry;
737
+ /**
738
+ * An alternative registry that uses expanded, more permissive patterns for each
739
+ * detector. Enables detection of obfuscated or partial PII at the cost of a higher
740
+ * false-positive rate.
741
+ *
742
+ * Use it by passing `aggressive: true` to {@link anonymize} / {@link createAnonymizer},
743
+ * or directly via this registry for low-level usage.
744
+ *
745
+ * @example
746
+ * ```ts
747
+ * import { AGGRESSIVE_DETECTOR_REGISTRY } from "anonyma/detectors";
748
+ *
749
+ * const matches = AGGRESSIVE_DETECTOR_REGISTRY.email("user [at] example [dot] com");
750
+ * ```
751
+ */
752
+ declare const AGGRESSIVE_DETECTOR_REGISTRY: DetectorRegistry;
753
+
754
+ export { AGGRESSIVE_DETECTOR_REGISTRY, DETECTOR_REGISTRY, detectAddress, detectApiKey, detectBankAccount, detectCaseNumber, detectCompanyRegistration, detectCreditCard, detectCreditCardAggressive, detectCryptocurrency, detectDateOfBirth, detectDriversLicense, detectEmail, detectEmailAggressive, detectHealthInsurance, detectIban, detectIpv4, detectIpv6, detectLicensePlate, detectMedicalRecord, detectName, detectNameAggressive, detectNationalId, detectPassport, detectPhone, detectPhoneAggressive, detectPrescription, detectSocialMedia, detectSsn, detectSsnAggressive, detectTaxId, detectTrackingNumber, detectUrl, detectVin, detectVinAggressive };