@discretion/core 0.1.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.
- package/CHANGELOG.md +117 -0
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/dist/src/checksums/aba.d.ts +25 -0
- package/dist/src/checksums/aba.d.ts.map +1 -0
- package/dist/src/checksums/aba.js +47 -0
- package/dist/src/checksums/aba.js.map +1 -0
- package/dist/src/checksums/digits.d.ts +55 -0
- package/dist/src/checksums/digits.d.ts.map +1 -0
- package/dist/src/checksums/digits.js +114 -0
- package/dist/src/checksums/digits.js.map +1 -0
- package/dist/src/checksums/icao9303.d.ts +29 -0
- package/dist/src/checksums/icao9303.d.ts.map +1 -0
- package/dist/src/checksums/icao9303.js +56 -0
- package/dist/src/checksums/icao9303.js.map +1 -0
- package/dist/src/checksums/index.d.ts +21 -0
- package/dist/src/checksums/index.d.ts.map +1 -0
- package/dist/src/checksums/index.js +21 -0
- package/dist/src/checksums/index.js.map +1 -0
- package/dist/src/checksums/iso7064.d.ts +67 -0
- package/dist/src/checksums/iso7064.d.ts.map +1 -0
- package/dist/src/checksums/iso7064.js +159 -0
- package/dist/src/checksums/iso7064.js.map +1 -0
- package/dist/src/checksums/luhn.d.ts +32 -0
- package/dist/src/checksums/luhn.d.ts.map +1 -0
- package/dist/src/checksums/luhn.js +66 -0
- package/dist/src/checksums/luhn.js.map +1 -0
- package/dist/src/checksums/mod97.d.ts +55 -0
- package/dist/src/checksums/mod97.d.ts.map +1 -0
- package/dist/src/checksums/mod97.js +94 -0
- package/dist/src/checksums/mod97.js.map +1 -0
- package/dist/src/checksums/verhoeff.d.ts +28 -0
- package/dist/src/checksums/verhoeff.d.ts.map +1 -0
- package/dist/src/checksums/verhoeff.js +80 -0
- package/dist/src/checksums/verhoeff.js.map +1 -0
- package/dist/src/checksums/weighted.d.ts +64 -0
- package/dist/src/checksums/weighted.d.ts.map +1 -0
- package/dist/src/checksums/weighted.js +97 -0
- package/dist/src/checksums/weighted.js.map +1 -0
- package/dist/src/context/documentProfile.d.ts +34 -0
- package/dist/src/context/documentProfile.d.ts.map +1 -0
- package/dist/src/context/documentProfile.js +253 -0
- package/dist/src/context/documentProfile.js.map +1 -0
- package/dist/src/context/negativeRules.d.ts +60 -0
- package/dist/src/context/negativeRules.d.ts.map +1 -0
- package/dist/src/context/negativeRules.js +696 -0
- package/dist/src/context/negativeRules.js.map +1 -0
- package/dist/src/context/score.d.ts +52 -0
- package/dist/src/context/score.d.ts.map +1 -0
- package/dist/src/context/score.js +346 -0
- package/dist/src/context/score.js.map +1 -0
- package/dist/src/context/structure.d.ts +46 -0
- package/dist/src/context/structure.d.ts.map +1 -0
- package/dist/src/context/structure.js +528 -0
- package/dist/src/context/structure.js.map +1 -0
- package/dist/src/context/triggers.d.ts +73 -0
- package/dist/src/context/triggers.d.ts.map +1 -0
- package/dist/src/context/triggers.js +172 -0
- package/dist/src/context/triggers.js.map +1 -0
- package/dist/src/context/types.d.ts +137 -0
- package/dist/src/context/types.d.ts.map +1 -0
- package/dist/src/context/types.js +25 -0
- package/dist/src/context/types.js.map +1 -0
- package/dist/src/crypto/keccak256.d.ts +15 -0
- package/dist/src/crypto/keccak256.d.ts.map +1 -0
- package/dist/src/crypto/keccak256.js +89 -0
- package/dist/src/crypto/keccak256.js.map +1 -0
- package/dist/src/crypto/sha256.d.ts +16 -0
- package/dist/src/crypto/sha256.d.ts.map +1 -0
- package/dist/src/crypto/sha256.js +81 -0
- package/dist/src/crypto/sha256.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.d.ts +11 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.js +34 -0
- package/dist/src/detect/detectors/bankcodes/auBsb.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.d.ts +15 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.js +43 -0
- package/dist/src/detect/detectors/bankcodes/brAgencia.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.js +86 -0
- package/dist/src/detect/detectors/bankcodes/caTransit.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.js +37 -0
- package/dist/src/detect/detectors/bankcodes/inIfsc.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/index.d.ts +10 -0
- package/dist/src/detect/detectors/bankcodes/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/index.js +10 -0
- package/dist/src/detect/detectors/bankcodes/index.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.d.ts +13 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.js +36 -0
- package/dist/src/detect/detectors/bankcodes/ukSortCode.js.map +1 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.d.ts +12 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.d.ts.map +1 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.js +45 -0
- package/dist/src/detect/detectors/bankcodes/usRouting.js.map +1 -0
- package/dist/src/detect/detectors/contact/email.d.ts +16 -0
- package/dist/src/detect/detectors/contact/email.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/email.js +111 -0
- package/dist/src/detect/detectors/contact/email.js.map +1 -0
- package/dist/src/detect/detectors/contact/index.d.ts +11 -0
- package/dist/src/detect/detectors/contact/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/index.js +11 -0
- package/dist/src/detect/detectors/contact/index.js.map +1 -0
- package/dist/src/detect/detectors/contact/ipv4.d.ts +12 -0
- package/dist/src/detect/detectors/contact/ipv4.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/ipv4.js +109 -0
- package/dist/src/detect/detectors/contact/ipv4.js.map +1 -0
- package/dist/src/detect/detectors/contact/ipv6.d.ts +16 -0
- package/dist/src/detect/detectors/contact/ipv6.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/ipv6.js +187 -0
- package/dist/src/detect/detectors/contact/ipv6.js.map +1 -0
- package/dist/src/detect/detectors/contact/mac.d.ts +14 -0
- package/dist/src/detect/detectors/contact/mac.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/mac.js +64 -0
- package/dist/src/detect/detectors/contact/mac.js.map +1 -0
- package/dist/src/detect/detectors/contact/phone.d.ts +21 -0
- package/dist/src/detect/detectors/contact/phone.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/phone.js +76 -0
- package/dist/src/detect/detectors/contact/phone.js.map +1 -0
- package/dist/src/detect/detectors/contact/urlCredentials.d.ts +23 -0
- package/dist/src/detect/detectors/contact/urlCredentials.d.ts.map +1 -0
- package/dist/src/detect/detectors/contact/urlCredentials.js +123 -0
- package/dist/src/detect/detectors/contact/urlCredentials.js.map +1 -0
- package/dist/src/detect/detectors/crypto/ada.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/ada.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/ada.js +51 -0
- package/dist/src/detect/detectors/crypto/ada.js.map +1 -0
- package/dist/src/detect/detectors/crypto/btc.d.ts +15 -0
- package/dist/src/detect/detectors/crypto/btc.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/btc.js +78 -0
- package/dist/src/detect/detectors/crypto/btc.js.map +1 -0
- package/dist/src/detect/detectors/crypto/dot.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/dot.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/dot.js +41 -0
- package/dist/src/detect/detectors/crypto/dot.js.map +1 -0
- package/dist/src/detect/detectors/crypto/eth.d.ts +15 -0
- package/dist/src/detect/detectors/crypto/eth.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/eth.js +63 -0
- package/dist/src/detect/detectors/crypto/eth.js.map +1 -0
- package/dist/src/detect/detectors/crypto/index.d.ts +12 -0
- package/dist/src/detect/detectors/crypto/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/index.js +12 -0
- package/dist/src/detect/detectors/crypto/index.js.map +1 -0
- package/dist/src/detect/detectors/crypto/ltc.d.ts +12 -0
- package/dist/src/detect/detectors/crypto/ltc.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/ltc.js +71 -0
- package/dist/src/detect/detectors/crypto/ltc.js.map +1 -0
- package/dist/src/detect/detectors/crypto/sol.d.ts +13 -0
- package/dist/src/detect/detectors/crypto/sol.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/sol.js +39 -0
- package/dist/src/detect/detectors/crypto/sol.js.map +1 -0
- package/dist/src/detect/detectors/crypto/trx.d.ts +8 -0
- package/dist/src/detect/detectors/crypto/trx.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/trx.js +34 -0
- package/dist/src/detect/detectors/crypto/trx.js.map +1 -0
- package/dist/src/detect/detectors/crypto/xmr.d.ts +10 -0
- package/dist/src/detect/detectors/crypto/xmr.d.ts.map +1 -0
- package/dist/src/detect/detectors/crypto/xmr.js +51 -0
- package/dist/src/detect/detectors/crypto/xmr.js.map +1 -0
- package/dist/src/detect/detectors/documents/driversLicense.d.ts +24 -0
- package/dist/src/detect/detectors/documents/driversLicense.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/driversLicense.js +79 -0
- package/dist/src/detect/detectors/documents/driversLicense.js.map +1 -0
- package/dist/src/detect/detectors/documents/healthData.d.ts +23 -0
- package/dist/src/detect/detectors/documents/healthData.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/healthData.js +78 -0
- package/dist/src/detect/detectors/documents/healthData.js.map +1 -0
- package/dist/src/detect/detectors/documents/index.d.ts +9 -0
- package/dist/src/detect/detectors/documents/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/index.js +9 -0
- package/dist/src/detect/detectors/documents/index.js.map +1 -0
- package/dist/src/detect/detectors/documents/passportMrz.d.ts +20 -0
- package/dist/src/detect/detectors/documents/passportMrz.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/passportMrz.js +194 -0
- package/dist/src/detect/detectors/documents/passportMrz.js.map +1 -0
- package/dist/src/detect/detectors/documents/usNpi.d.ts +16 -0
- package/dist/src/detect/detectors/documents/usNpi.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/usNpi.js +48 -0
- package/dist/src/detect/detectors/documents/usNpi.js.map +1 -0
- package/dist/src/detect/detectors/documents/vin.d.ts +15 -0
- package/dist/src/detect/detectors/documents/vin.d.ts.map +1 -0
- package/dist/src/detect/detectors/documents/vin.js +64 -0
- package/dist/src/detect/detectors/documents/vin.js.map +1 -0
- package/dist/src/detect/detectors/financial/creditCard.d.ts +23 -0
- package/dist/src/detect/detectors/financial/creditCard.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/creditCard.js +157 -0
- package/dist/src/detect/detectors/financial/creditCard.js.map +1 -0
- package/dist/src/detect/detectors/financial/iban.d.ts +18 -0
- package/dist/src/detect/detectors/financial/iban.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/iban.js +80 -0
- package/dist/src/detect/detectors/financial/iban.js.map +1 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.d.ts +35 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.js +92 -0
- package/dist/src/detect/detectors/financial/ibanRegistry.js.map +1 -0
- package/dist/src/detect/detectors/financial/index.d.ts +7 -0
- package/dist/src/detect/detectors/financial/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/index.js +7 -0
- package/dist/src/detect/detectors/financial/index.js.map +1 -0
- package/dist/src/detect/detectors/financial/swiftBic.d.ts +17 -0
- package/dist/src/detect/detectors/financial/swiftBic.d.ts.map +1 -0
- package/dist/src/detect/detectors/financial/swiftBic.js +55 -0
- package/dist/src/detect/detectors/financial/swiftBic.js.map +1 -0
- package/dist/src/detect/detectors/index.d.ts +15 -0
- package/dist/src/detect/detectors/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/index.js +15 -0
- package/dist/src/detect/detectors/index.js.map +1 -0
- package/dist/src/detect/detectors/location/coordinates.d.ts +14 -0
- package/dist/src/detect/detectors/location/coordinates.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/coordinates.js +79 -0
- package/dist/src/detect/detectors/location/coordinates.js.map +1 -0
- package/dist/src/detect/detectors/location/index.d.ts +7 -0
- package/dist/src/detect/detectors/location/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/index.js +7 -0
- package/dist/src/detect/detectors/location/index.js.map +1 -0
- package/dist/src/detect/detectors/location/postalCode.d.ts +13 -0
- package/dist/src/detect/detectors/location/postalCode.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/postalCode.js +53 -0
- package/dist/src/detect/detectors/location/postalCode.js.map +1 -0
- package/dist/src/detect/detectors/location/postalRegistry.d.ts +19 -0
- package/dist/src/detect/detectors/location/postalRegistry.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/postalRegistry.js +73 -0
- package/dist/src/detect/detectors/location/postalRegistry.js.map +1 -0
- package/dist/src/detect/detectors/location/streetAddress.d.ts +21 -0
- package/dist/src/detect/detectors/location/streetAddress.d.ts.map +1 -0
- package/dist/src/detect/detectors/location/streetAddress.js +70 -0
- package/dist/src/detect/detectors/location/streetAddress.js.map +1 -0
- package/dist/src/detect/detectors/natid/africa.d.ts +17 -0
- package/dist/src/detect/detectors/natid/africa.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/africa.js +106 -0
- package/dist/src/detect/detectors/natid/africa.js.map +1 -0
- package/dist/src/detect/detectors/natid/ar.d.ts +14 -0
- package/dist/src/detect/detectors/natid/ar.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ar.js +62 -0
- package/dist/src/detect/detectors/natid/ar.js.map +1 -0
- package/dist/src/detect/detectors/natid/au.d.ts +13 -0
- package/dist/src/detect/detectors/natid/au.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/au.js +100 -0
- package/dist/src/detect/detectors/natid/au.js.map +1 -0
- package/dist/src/detect/detectors/natid/be.d.ts +8 -0
- package/dist/src/detect/detectors/natid/be.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/be.js +44 -0
- package/dist/src/detect/detectors/natid/be.js.map +1 -0
- package/dist/src/detect/detectors/natid/bg.d.ts +7 -0
- package/dist/src/detect/detectors/natid/bg.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/bg.js +44 -0
- package/dist/src/detect/detectors/natid/bg.js.map +1 -0
- package/dist/src/detect/detectors/natid/br.d.ts +8 -0
- package/dist/src/detect/detectors/natid/br.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/br.js +85 -0
- package/dist/src/detect/detectors/natid/br.js.map +1 -0
- package/dist/src/detect/detectors/natid/ca.d.ts +8 -0
- package/dist/src/detect/detectors/natid/ca.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ca.js +41 -0
- package/dist/src/detect/detectors/natid/ca.js.map +1 -0
- package/dist/src/detect/detectors/natid/cl.d.ts +9 -0
- package/dist/src/detect/detectors/natid/cl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cl.js +47 -0
- package/dist/src/detect/detectors/natid/cl.js.map +1 -0
- package/dist/src/detect/detectors/natid/cn.d.ts +9 -0
- package/dist/src/detect/detectors/natid/cn.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cn.js +49 -0
- package/dist/src/detect/detectors/natid/cn.js.map +1 -0
- package/dist/src/detect/detectors/natid/co.d.ts +10 -0
- package/dist/src/detect/detectors/natid/co.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/co.js +43 -0
- package/dist/src/detect/detectors/natid/co.js.map +1 -0
- package/dist/src/detect/detectors/natid/cz.d.ts +11 -0
- package/dist/src/detect/detectors/natid/cz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/cz.js +44 -0
- package/dist/src/detect/detectors/natid/cz.js.map +1 -0
- package/dist/src/detect/detectors/natid/de.d.ts +16 -0
- package/dist/src/detect/detectors/natid/de.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/de.js +77 -0
- package/dist/src/detect/detectors/natid/de.js.map +1 -0
- package/dist/src/detect/detectors/natid/dk.d.ts +9 -0
- package/dist/src/detect/detectors/natid/dk.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/dk.js +31 -0
- package/dist/src/detect/detectors/natid/dk.js.map +1 -0
- package/dist/src/detect/detectors/natid/es.d.ts +12 -0
- package/dist/src/detect/detectors/natid/es.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/es.js +96 -0
- package/dist/src/detect/detectors/natid/es.js.map +1 -0
- package/dist/src/detect/detectors/natid/fi.d.ts +10 -0
- package/dist/src/detect/detectors/natid/fi.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/fi.js +40 -0
- package/dist/src/detect/detectors/natid/fi.js.map +1 -0
- package/dist/src/detect/detectors/natid/fr.d.ts +12 -0
- package/dist/src/detect/detectors/natid/fr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/fr.js +61 -0
- package/dist/src/detect/detectors/natid/fr.js.map +1 -0
- package/dist/src/detect/detectors/natid/gb.d.ts +10 -0
- package/dist/src/detect/detectors/natid/gb.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gb.js +72 -0
- package/dist/src/detect/detectors/natid/gb.js.map +1 -0
- package/dist/src/detect/detectors/natid/gr.d.ts +7 -0
- package/dist/src/detect/detectors/natid/gr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gr.js +36 -0
- package/dist/src/detect/detectors/natid/gr.js.map +1 -0
- package/dist/src/detect/detectors/natid/gulf.d.ts +16 -0
- package/dist/src/detect/detectors/natid/gulf.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/gulf.js +121 -0
- package/dist/src/detect/detectors/natid/gulf.js.map +1 -0
- package/dist/src/detect/detectors/natid/hk.d.ts +9 -0
- package/dist/src/detect/detectors/natid/hk.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hk.js +41 -0
- package/dist/src/detect/detectors/natid/hk.js.map +1 -0
- package/dist/src/detect/detectors/natid/hr.d.ts +6 -0
- package/dist/src/detect/detectors/natid/hr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hr.js +32 -0
- package/dist/src/detect/detectors/natid/hr.js.map +1 -0
- package/dist/src/detect/detectors/natid/hu.d.ts +7 -0
- package/dist/src/detect/detectors/natid/hu.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/hu.js +37 -0
- package/dist/src/detect/detectors/natid/hu.js.map +1 -0
- package/dist/src/detect/detectors/natid/ie.d.ts +9 -0
- package/dist/src/detect/detectors/natid/ie.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ie.js +36 -0
- package/dist/src/detect/detectors/natid/ie.js.map +1 -0
- package/dist/src/detect/detectors/natid/il.d.ts +10 -0
- package/dist/src/detect/detectors/natid/il.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/il.js +38 -0
- package/dist/src/detect/detectors/natid/il.js.map +1 -0
- package/dist/src/detect/detectors/natid/in.d.ts +17 -0
- package/dist/src/detect/detectors/natid/in.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/in.js +67 -0
- package/dist/src/detect/detectors/natid/in.js.map +1 -0
- package/dist/src/detect/detectors/natid/index.d.ts +55 -0
- package/dist/src/detect/detectors/natid/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/index.js +55 -0
- package/dist/src/detect/detectors/natid/index.js.map +1 -0
- package/dist/src/detect/detectors/natid/is.d.ts +8 -0
- package/dist/src/detect/detectors/natid/is.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/is.js +42 -0
- package/dist/src/detect/detectors/natid/is.js.map +1 -0
- package/dist/src/detect/detectors/natid/it.d.ts +12 -0
- package/dist/src/detect/detectors/natid/it.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/it.js +62 -0
- package/dist/src/detect/detectors/natid/it.js.map +1 -0
- package/dist/src/detect/detectors/natid/jp.d.ts +9 -0
- package/dist/src/detect/detectors/natid/jp.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/jp.js +46 -0
- package/dist/src/detect/detectors/natid/jp.js.map +1 -0
- package/dist/src/detect/detectors/natid/kr.d.ts +11 -0
- package/dist/src/detect/detectors/natid/kr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/kr.js +40 -0
- package/dist/src/detect/detectors/natid/kr.js.map +1 -0
- package/dist/src/detect/detectors/natid/kz.d.ts +8 -0
- package/dist/src/detect/detectors/natid/kz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/kz.js +46 -0
- package/dist/src/detect/detectors/natid/kz.js.map +1 -0
- package/dist/src/detect/detectors/natid/mx.d.ts +16 -0
- package/dist/src/detect/detectors/natid/mx.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/mx.js +82 -0
- package/dist/src/detect/detectors/natid/mx.js.map +1 -0
- package/dist/src/detect/detectors/natid/nl.d.ts +8 -0
- package/dist/src/detect/detectors/natid/nl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/nl.js +40 -0
- package/dist/src/detect/detectors/natid/nl.js.map +1 -0
- package/dist/src/detect/detectors/natid/no.d.ts +9 -0
- package/dist/src/detect/detectors/natid/no.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/no.js +52 -0
- package/dist/src/detect/detectors/natid/no.js.map +1 -0
- package/dist/src/detect/detectors/natid/nz.d.ts +9 -0
- package/dist/src/detect/detectors/natid/nz.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/nz.js +52 -0
- package/dist/src/detect/detectors/natid/nz.js.map +1 -0
- package/dist/src/detect/detectors/natid/pe.d.ts +7 -0
- package/dist/src/detect/detectors/natid/pe.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pe.js +26 -0
- package/dist/src/detect/detectors/natid/pe.js.map +1 -0
- package/dist/src/detect/detectors/natid/pl.d.ts +11 -0
- package/dist/src/detect/detectors/natid/pl.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pl.js +105 -0
- package/dist/src/detect/detectors/natid/pl.js.map +1 -0
- package/dist/src/detect/detectors/natid/pt.d.ts +6 -0
- package/dist/src/detect/detectors/natid/pt.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/pt.js +35 -0
- package/dist/src/detect/detectors/natid/pt.js.map +1 -0
- package/dist/src/detect/detectors/natid/ro.d.ts +8 -0
- package/dist/src/detect/detectors/natid/ro.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ro.js +48 -0
- package/dist/src/detect/detectors/natid/ro.js.map +1 -0
- package/dist/src/detect/detectors/natid/ru.d.ts +11 -0
- package/dist/src/detect/detectors/natid/ru.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ru.js +86 -0
- package/dist/src/detect/detectors/natid/ru.js.map +1 -0
- package/dist/src/detect/detectors/natid/se.d.ts +9 -0
- package/dist/src/detect/detectors/natid/se.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/se.js +43 -0
- package/dist/src/detect/detectors/natid/se.js.map +1 -0
- package/dist/src/detect/detectors/natid/seasia.d.ts +19 -0
- package/dist/src/detect/detectors/natid/seasia.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/seasia.js +182 -0
- package/dist/src/detect/detectors/natid/seasia.js.map +1 -0
- package/dist/src/detect/detectors/natid/sg.d.ts +8 -0
- package/dist/src/detect/detectors/natid/sg.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/sg.js +39 -0
- package/dist/src/detect/detectors/natid/sg.js.map +1 -0
- package/dist/src/detect/detectors/natid/si.d.ts +8 -0
- package/dist/src/detect/detectors/natid/si.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/si.js +44 -0
- package/dist/src/detect/detectors/natid/si.js.map +1 -0
- package/dist/src/detect/detectors/natid/tr.d.ts +14 -0
- package/dist/src/detect/detectors/natid/tr.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/tr.js +79 -0
- package/dist/src/detect/detectors/natid/tr.js.map +1 -0
- package/dist/src/detect/detectors/natid/tw.d.ts +9 -0
- package/dist/src/detect/detectors/natid/tw.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/tw.js +40 -0
- package/dist/src/detect/detectors/natid/tw.js.map +1 -0
- package/dist/src/detect/detectors/natid/ua.d.ts +7 -0
- package/dist/src/detect/detectors/natid/ua.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/ua.js +38 -0
- package/dist/src/detect/detectors/natid/ua.js.map +1 -0
- package/dist/src/detect/detectors/natid/us.d.ts +15 -0
- package/dist/src/detect/detectors/natid/us.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/us.js +119 -0
- package/dist/src/detect/detectors/natid/us.js.map +1 -0
- package/dist/src/detect/detectors/natid/za.d.ts +9 -0
- package/dist/src/detect/detectors/natid/za.d.ts.map +1 -0
- package/dist/src/detect/detectors/natid/za.js +44 -0
- package/dist/src/detect/detectors/natid/za.js.map +1 -0
- package/dist/src/detect/detectors/secrets/apiKey.d.ts +14 -0
- package/dist/src/detect/detectors/secrets/apiKey.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/apiKey.js +103 -0
- package/dist/src/detect/detectors/secrets/apiKey.js.map +1 -0
- package/dist/src/detect/detectors/secrets/connectionString.d.ts +12 -0
- package/dist/src/detect/detectors/secrets/connectionString.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/connectionString.js +70 -0
- package/dist/src/detect/detectors/secrets/connectionString.js.map +1 -0
- package/dist/src/detect/detectors/secrets/genericSecret.d.ts +22 -0
- package/dist/src/detect/detectors/secrets/genericSecret.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/genericSecret.js +77 -0
- package/dist/src/detect/detectors/secrets/genericSecret.js.map +1 -0
- package/dist/src/detect/detectors/secrets/index.d.ts +9 -0
- package/dist/src/detect/detectors/secrets/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/index.js +9 -0
- package/dist/src/detect/detectors/secrets/index.js.map +1 -0
- package/dist/src/detect/detectors/secrets/jwt.d.ts +11 -0
- package/dist/src/detect/detectors/secrets/jwt.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/jwt.js +111 -0
- package/dist/src/detect/detectors/secrets/jwt.js.map +1 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.d.ts +16 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.d.ts.map +1 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.js +56 -0
- package/dist/src/detect/detectors/secrets/pemPrivateKey.js.map +1 -0
- package/dist/src/detect/detectors/vat/euVat.d.ts +17 -0
- package/dist/src/detect/detectors/vat/euVat.d.ts.map +1 -0
- package/dist/src/detect/detectors/vat/euVat.js +293 -0
- package/dist/src/detect/detectors/vat/euVat.js.map +1 -0
- package/dist/src/detect/detectors/vat/index.d.ts +5 -0
- package/dist/src/detect/detectors/vat/index.d.ts.map +1 -0
- package/dist/src/detect/detectors/vat/index.js +5 -0
- package/dist/src/detect/detectors/vat/index.js.map +1 -0
- package/dist/src/detect/entropy.d.ts +28 -0
- package/dist/src/detect/entropy.d.ts.map +1 -0
- package/dist/src/detect/entropy.js +64 -0
- package/dist/src/detect/entropy.js.map +1 -0
- package/dist/src/detect/isoCountries.d.ts +10 -0
- package/dist/src/detect/isoCountries.d.ts.map +1 -0
- package/dist/src/detect/isoCountries.js +25 -0
- package/dist/src/detect/isoCountries.js.map +1 -0
- package/dist/src/detect/registry.d.ts +50 -0
- package/dist/src/detect/registry.d.ts.map +1 -0
- package/dist/src/detect/registry.js +110 -0
- package/dist/src/detect/registry.js.map +1 -0
- package/dist/src/detect/runner.d.ts +64 -0
- package/dist/src/detect/runner.d.ts.map +1 -0
- package/dist/src/detect/runner.js +142 -0
- package/dist/src/detect/runner.js.map +1 -0
- package/dist/src/detect/types.d.ts +251 -0
- package/dist/src/detect/types.d.ts.map +1 -0
- package/dist/src/detect/types.js +59 -0
- package/dist/src/detect/types.js.map +1 -0
- package/dist/src/encoding/base58.d.ts +26 -0
- package/dist/src/encoding/base58.d.ts.map +1 -0
- package/dist/src/encoding/base58.js +77 -0
- package/dist/src/encoding/base58.js.map +1 -0
- package/dist/src/encoding/base58monero.d.ts +15 -0
- package/dist/src/encoding/base58monero.d.ts.map +1 -0
- package/dist/src/encoding/base58monero.js +87 -0
- package/dist/src/encoding/base58monero.js.map +1 -0
- package/dist/src/encoding/bech32.d.ts +28 -0
- package/dist/src/encoding/bech32.d.ts.map +1 -0
- package/dist/src/encoding/bech32.js +108 -0
- package/dist/src/encoding/bech32.js.map +1 -0
- package/dist/src/encoding/bytes.d.ts +15 -0
- package/dist/src/encoding/bytes.d.ts.map +1 -0
- package/dist/src/encoding/bytes.js +46 -0
- package/dist/src/encoding/bytes.js.map +1 -0
- package/dist/src/entityFamily.d.ts +18 -0
- package/dist/src/entityFamily.d.ts.map +1 -0
- package/dist/src/entityFamily.js +54 -0
- package/dist/src/entityFamily.js.map +1 -0
- package/dist/src/entityLabel.d.ts +18 -0
- package/dist/src/entityLabel.d.ts.map +1 -0
- package/dist/src/entityLabel.js +53 -0
- package/dist/src/entityLabel.js.map +1 -0
- package/dist/src/entityTypes.d.ts +64 -0
- package/dist/src/entityTypes.d.ts.map +1 -0
- package/dist/src/entityTypes.js +94 -0
- package/dist/src/entityTypes.js.map +1 -0
- package/dist/src/exposure/index.d.ts +86 -0
- package/dist/src/exposure/index.d.ts.map +1 -0
- package/dist/src/exposure/index.js +134 -0
- package/dist/src/exposure/index.js.map +1 -0
- package/dist/src/fuse/calibrate.d.ts +95 -0
- package/dist/src/fuse/calibrate.d.ts.map +1 -0
- package/dist/src/fuse/calibrate.js +165 -0
- package/dist/src/fuse/calibrate.js.map +1 -0
- package/dist/src/fuse/defaultCalibration.d.ts +52 -0
- package/dist/src/fuse/defaultCalibration.d.ts.map +1 -0
- package/dist/src/fuse/defaultCalibration.js +41 -0
- package/dist/src/fuse/defaultCalibration.js.map +1 -0
- package/dist/src/fuse/explain.d.ts +55 -0
- package/dist/src/fuse/explain.d.ts.map +1 -0
- package/dist/src/fuse/explain.js +91 -0
- package/dist/src/fuse/explain.js.map +1 -0
- package/dist/src/fuse/profiles.d.ts +80 -0
- package/dist/src/fuse/profiles.d.ts.map +1 -0
- package/dist/src/fuse/profiles.js +126 -0
- package/dist/src/fuse/profiles.js.map +1 -0
- package/dist/src/fuse/resolve.d.ts +73 -0
- package/dist/src/fuse/resolve.d.ts.map +1 -0
- package/dist/src/fuse/resolve.js +206 -0
- package/dist/src/fuse/resolve.js.map +1 -0
- package/dist/src/gazetteer/index.d.ts +41 -0
- package/dist/src/gazetteer/index.d.ts.map +1 -0
- package/dist/src/gazetteer/index.js +117 -0
- package/dist/src/gazetteer/index.js.map +1 -0
- package/dist/src/generate/bankcodes.d.ts +20 -0
- package/dist/src/generate/bankcodes.d.ts.map +1 -0
- package/dist/src/generate/bankcodes.js +71 -0
- package/dist/src/generate/bankcodes.js.map +1 -0
- package/dist/src/generate/contact.d.ts +31 -0
- package/dist/src/generate/contact.d.ts.map +1 -0
- package/dist/src/generate/contact.js +139 -0
- package/dist/src/generate/contact.js.map +1 -0
- package/dist/src/generate/crypto.d.ts +27 -0
- package/dist/src/generate/crypto.d.ts.map +1 -0
- package/dist/src/generate/crypto.js +88 -0
- package/dist/src/generate/crypto.js.map +1 -0
- package/dist/src/generate/documents.d.ts +24 -0
- package/dist/src/generate/documents.d.ts.map +1 -0
- package/dist/src/generate/documents.js +124 -0
- package/dist/src/generate/documents.js.map +1 -0
- package/dist/src/generate/financial.d.ts +26 -0
- package/dist/src/generate/financial.d.ts.map +1 -0
- package/dist/src/generate/financial.js +136 -0
- package/dist/src/generate/financial.js.map +1 -0
- package/dist/src/generate/index.d.ts +23 -0
- package/dist/src/generate/index.d.ts.map +1 -0
- package/dist/src/generate/index.js +23 -0
- package/dist/src/generate/index.js.map +1 -0
- package/dist/src/generate/location.d.ts +12 -0
- package/dist/src/generate/location.d.ts.map +1 -0
- package/dist/src/generate/location.js +75 -0
- package/dist/src/generate/location.js.map +1 -0
- package/dist/src/generate/natidAmOc.d.ts +22 -0
- package/dist/src/generate/natidAmOc.d.ts.map +1 -0
- package/dist/src/generate/natidAmOc.js +181 -0
- package/dist/src/generate/natidAmOc.js.map +1 -0
- package/dist/src/generate/natidAsia.d.ts +20 -0
- package/dist/src/generate/natidAsia.d.ts.map +1 -0
- package/dist/src/generate/natidAsia.js +147 -0
- package/dist/src/generate/natidAsia.js.map +1 -0
- package/dist/src/generate/natidCee.d.ts +21 -0
- package/dist/src/generate/natidCee.d.ts.map +1 -0
- package/dist/src/generate/natidCee.js +181 -0
- package/dist/src/generate/natidCee.js.map +1 -0
- package/dist/src/generate/natidMeCis.d.ts +17 -0
- package/dist/src/generate/natidMeCis.d.ts.map +1 -0
- package/dist/src/generate/natidMeCis.js +121 -0
- package/dist/src/generate/natidMeCis.js.map +1 -0
- package/dist/src/generate/natidWest.d.ts +32 -0
- package/dist/src/generate/natidWest.d.ts.map +1 -0
- package/dist/src/generate/natidWest.js +187 -0
- package/dist/src/generate/natidWest.js.map +1 -0
- package/dist/src/generate/prng.d.ts +10 -0
- package/dist/src/generate/prng.d.ts.map +1 -0
- package/dist/src/generate/prng.js +18 -0
- package/dist/src/generate/prng.js.map +1 -0
- package/dist/src/generate/secrets.d.ts +23 -0
- package/dist/src/generate/secrets.d.ts.map +1 -0
- package/dist/src/generate/secrets.js +126 -0
- package/dist/src/generate/secrets.js.map +1 -0
- package/dist/src/generate/vat.d.ts +11 -0
- package/dist/src/generate/vat.d.ts.map +1 -0
- package/dist/src/generate/vat.js +233 -0
- package/dist/src/generate/vat.js.map +1 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +76 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mask/egressGuard.d.ts +54 -0
- package/dist/src/mask/egressGuard.d.ts.map +1 -0
- package/dist/src/mask/egressGuard.js +67 -0
- package/dist/src/mask/egressGuard.js.map +1 -0
- package/dist/src/mask/masker.d.ts +76 -0
- package/dist/src/mask/masker.d.ts.map +1 -0
- package/dist/src/mask/masker.js +201 -0
- package/dist/src/mask/masker.js.map +1 -0
- package/dist/src/mask/restorer.d.ts +96 -0
- package/dist/src/mask/restorer.d.ts.map +1 -0
- package/dist/src/mask/restorer.js +263 -0
- package/dist/src/mask/restorer.js.map +1 -0
- package/dist/src/mask/surrogatePools.d.ts +33 -0
- package/dist/src/mask/surrogatePools.d.ts.map +1 -0
- package/dist/src/mask/surrogatePools.js +81 -0
- package/dist/src/mask/surrogatePools.js.map +1 -0
- package/dist/src/mask/surrogates.d.ts +45 -0
- package/dist/src/mask/surrogates.d.ts.map +1 -0
- package/dist/src/mask/surrogates.js +241 -0
- package/dist/src/mask/surrogates.js.map +1 -0
- package/dist/src/mask/vault.d.ts +76 -0
- package/dist/src/mask/vault.d.ts.map +1 -0
- package/dist/src/mask/vault.js +141 -0
- package/dist/src/mask/vault.js.map +1 -0
- package/dist/src/ner/align.d.ts +36 -0
- package/dist/src/ner/align.d.ts.map +1 -0
- package/dist/src/ner/align.js +73 -0
- package/dist/src/ner/align.js.map +1 -0
- package/dist/src/ner/chunk.d.ts +27 -0
- package/dist/src/ner/chunk.d.ts.map +1 -0
- package/dist/src/ner/chunk.js +55 -0
- package/dist/src/ner/chunk.js.map +1 -0
- package/dist/src/ner/chunkCache.d.ts +63 -0
- package/dist/src/ner/chunkCache.d.ts.map +1 -0
- package/dist/src/ner/chunkCache.js +99 -0
- package/dist/src/ner/chunkCache.js.map +1 -0
- package/dist/src/ner/engine.d.ts +53 -0
- package/dist/src/ner/engine.d.ts.map +1 -0
- package/dist/src/ner/engine.js +113 -0
- package/dist/src/ner/engine.js.map +1 -0
- package/dist/src/ner/merge.d.ts +26 -0
- package/dist/src/ner/merge.d.ts.map +1 -0
- package/dist/src/ner/merge.js +108 -0
- package/dist/src/ner/merge.js.map +1 -0
- package/dist/src/ner/runStage2.d.ts +17 -0
- package/dist/src/ner/runStage2.d.ts.map +1 -0
- package/dist/src/ner/runStage2.js +43 -0
- package/dist/src/ner/runStage2.js.map +1 -0
- package/dist/src/ner/stage2b.d.ts +59 -0
- package/dist/src/ner/stage2b.d.ts.map +1 -0
- package/dist/src/ner/stage2b.js +51 -0
- package/dist/src/ner/stage2b.js.map +1 -0
- package/dist/src/ner/transformersClassifier.d.ts +45 -0
- package/dist/src/ner/transformersClassifier.d.ts.map +1 -0
- package/dist/src/ner/transformersClassifier.js +40 -0
- package/dist/src/ner/transformersClassifier.js.map +1 -0
- package/dist/src/ner/types.d.ts +93 -0
- package/dist/src/ner/types.d.ts.map +1 -0
- package/dist/src/ner/types.js +12 -0
- package/dist/src/ner/types.js.map +1 -0
- package/dist/src/normalization.d.ts +24 -0
- package/dist/src/normalization.d.ts.map +1 -0
- package/dist/src/normalization.js +92 -0
- package/dist/src/normalization.js.map +1 -0
- package/dist/src/offsetMap.d.ts +165 -0
- package/dist/src/offsetMap.d.ts.map +1 -0
- package/dist/src/offsetMap.js +225 -0
- package/dist/src/offsetMap.js.map +1 -0
- package/dist/src/pipeline.d.ts +58 -0
- package/dist/src/pipeline.d.ts.map +1 -0
- package/dist/src/pipeline.js +57 -0
- package/dist/src/pipeline.js.map +1 -0
- package/dist/src/protect.d.ts +146 -0
- package/dist/src/protect.d.ts.map +1 -0
- package/dist/src/protect.js +161 -0
- package/dist/src/protect.js.map +1 -0
- package/dist/src/scripts.d.ts +37 -0
- package/dist/src/scripts.d.ts.map +1 -0
- package/dist/src/scripts.js +145 -0
- package/dist/src/scripts.js.map +1 -0
- package/dist/src/transforms/foldDigits.d.ts +49 -0
- package/dist/src/transforms/foldDigits.d.ts.map +1 -0
- package/dist/src/transforms/foldDigits.js +135 -0
- package/dist/src/transforms/foldDigits.js.map +1 -0
- package/dist/src/transforms/graphemes.d.ts +6 -0
- package/dist/src/transforms/graphemes.d.ts.map +1 -0
- package/dist/src/transforms/graphemes.js +6 -0
- package/dist/src/transforms/graphemes.js.map +1 -0
- package/dist/src/transforms/homoglyphFold.d.ts +5 -0
- package/dist/src/transforms/homoglyphFold.d.ts.map +1 -0
- package/dist/src/transforms/homoglyphFold.js +214 -0
- package/dist/src/transforms/homoglyphFold.js.map +1 -0
- package/dist/src/transforms/nfkc.d.ts +20 -0
- package/dist/src/transforms/nfkc.d.ts.map +1 -0
- package/dist/src/transforms/nfkc.js +48 -0
- package/dist/src/transforms/nfkc.js.map +1 -0
- package/dist/src/transforms/stripInvisibles.d.ts +37 -0
- package/dist/src/transforms/stripInvisibles.d.ts.map +1 -0
- package/dist/src/transforms/stripInvisibles.js +151 -0
- package/dist/src/transforms/stripInvisibles.js.map +1 -0
- package/dist/src/transforms/whitespacePunct.d.ts +21 -0
- package/dist/src/transforms/whitespacePunct.d.ts.map +1 -0
- package/dist/src/transforms/whitespacePunct.js +100 -0
- package/dist/src/transforms/whitespacePunct.js.map +1 -0
- package/dist/src/types.d.ts +212 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +14 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +67 -0
- package/src/checksums/aba.ts +45 -0
- package/src/checksums/digits.ts +108 -0
- package/src/checksums/icao9303.ts +53 -0
- package/src/checksums/index.ts +36 -0
- package/src/checksums/iso7064.ts +168 -0
- package/src/checksums/luhn.ts +66 -0
- package/src/checksums/mod97.ts +91 -0
- package/src/checksums/verhoeff.ts +84 -0
- package/src/checksums/weighted.ts +108 -0
- package/src/context/documentProfile.ts +293 -0
- package/src/context/negativeRules.ts +765 -0
- package/src/context/score.ts +430 -0
- package/src/context/structure.ts +611 -0
- package/src/context/triggers.ts +266 -0
- package/src/context/types.ts +150 -0
- package/src/crypto/keccak256.ts +98 -0
- package/src/crypto/sha256.ts +76 -0
- package/src/detect/AUTHORING.md +50 -0
- package/src/detect/detectors/bankcodes/auBsb.ts +36 -0
- package/src/detect/detectors/bankcodes/brAgencia.ts +46 -0
- package/src/detect/detectors/bankcodes/caTransit.ts +89 -0
- package/src/detect/detectors/bankcodes/inIfsc.ts +40 -0
- package/src/detect/detectors/bankcodes/index.ts +9 -0
- package/src/detect/detectors/bankcodes/ukSortCode.ts +38 -0
- package/src/detect/detectors/bankcodes/usRouting.ts +47 -0
- package/src/detect/detectors/contact/email.ts +113 -0
- package/src/detect/detectors/contact/index.ts +10 -0
- package/src/detect/detectors/contact/ipv4.ts +112 -0
- package/src/detect/detectors/contact/ipv6.ts +188 -0
- package/src/detect/detectors/contact/mac.ts +68 -0
- package/src/detect/detectors/contact/phone.ts +81 -0
- package/src/detect/detectors/contact/urlCredentials.ts +124 -0
- package/src/detect/detectors/crypto/ada.ts +52 -0
- package/src/detect/detectors/crypto/btc.ts +77 -0
- package/src/detect/detectors/crypto/dot.ts +42 -0
- package/src/detect/detectors/crypto/eth.ts +70 -0
- package/src/detect/detectors/crypto/index.ts +11 -0
- package/src/detect/detectors/crypto/ltc.ts +69 -0
- package/src/detect/detectors/crypto/sol.ts +41 -0
- package/src/detect/detectors/crypto/trx.ts +35 -0
- package/src/detect/detectors/crypto/xmr.ts +54 -0
- package/src/detect/detectors/documents/driversLicense.ts +83 -0
- package/src/detect/detectors/documents/healthData.ts +88 -0
- package/src/detect/detectors/documents/index.ts +8 -0
- package/src/detect/detectors/documents/passportMrz.ts +203 -0
- package/src/detect/detectors/documents/usNpi.ts +50 -0
- package/src/detect/detectors/documents/vin.ts +67 -0
- package/src/detect/detectors/financial/creditCard.ts +167 -0
- package/src/detect/detectors/financial/iban.ts +82 -0
- package/src/detect/detectors/financial/ibanRegistry.ts +112 -0
- package/src/detect/detectors/financial/index.ts +6 -0
- package/src/detect/detectors/financial/swiftBic.ts +61 -0
- package/src/detect/detectors/index.ts +14 -0
- package/src/detect/detectors/location/coordinates.ts +84 -0
- package/src/detect/detectors/location/index.ts +6 -0
- package/src/detect/detectors/location/postalCode.ts +56 -0
- package/src/detect/detectors/location/postalRegistry.ts +74 -0
- package/src/detect/detectors/location/streetAddress.ts +84 -0
- package/src/detect/detectors/natid/africa.ts +108 -0
- package/src/detect/detectors/natid/ar.ts +62 -0
- package/src/detect/detectors/natid/au.ts +99 -0
- package/src/detect/detectors/natid/be.ts +45 -0
- package/src/detect/detectors/natid/bg.ts +44 -0
- package/src/detect/detectors/natid/br.ts +81 -0
- package/src/detect/detectors/natid/ca.ts +40 -0
- package/src/detect/detectors/natid/cl.ts +47 -0
- package/src/detect/detectors/natid/cn.ts +48 -0
- package/src/detect/detectors/natid/co.ts +46 -0
- package/src/detect/detectors/natid/cz.ts +44 -0
- package/src/detect/detectors/natid/de.ts +75 -0
- package/src/detect/detectors/natid/dk.ts +31 -0
- package/src/detect/detectors/natid/es.ts +95 -0
- package/src/detect/detectors/natid/fi.ts +41 -0
- package/src/detect/detectors/natid/fr.ts +63 -0
- package/src/detect/detectors/natid/gb.ts +70 -0
- package/src/detect/detectors/natid/gr.ts +35 -0
- package/src/detect/detectors/natid/gulf.ts +116 -0
- package/src/detect/detectors/natid/hk.ts +42 -0
- package/src/detect/detectors/natid/hr.ts +32 -0
- package/src/detect/detectors/natid/hu.ts +36 -0
- package/src/detect/detectors/natid/ie.ts +37 -0
- package/src/detect/detectors/natid/il.ts +37 -0
- package/src/detect/detectors/natid/in.ts +67 -0
- package/src/detect/detectors/natid/index.ts +54 -0
- package/src/detect/detectors/natid/is.ts +42 -0
- package/src/detect/detectors/natid/it.ts +65 -0
- package/src/detect/detectors/natid/jp.ts +48 -0
- package/src/detect/detectors/natid/kr.ts +41 -0
- package/src/detect/detectors/natid/kz.ts +44 -0
- package/src/detect/detectors/natid/mx.ts +83 -0
- package/src/detect/detectors/natid/nl.ts +38 -0
- package/src/detect/detectors/natid/no.ts +50 -0
- package/src/detect/detectors/natid/nz.ts +53 -0
- package/src/detect/detectors/natid/pe.ts +28 -0
- package/src/detect/detectors/natid/pl.ts +100 -0
- package/src/detect/detectors/natid/pt.ts +36 -0
- package/src/detect/detectors/natid/ro.ts +47 -0
- package/src/detect/detectors/natid/ru.ts +82 -0
- package/src/detect/detectors/natid/se.ts +42 -0
- package/src/detect/detectors/natid/seasia.ts +174 -0
- package/src/detect/detectors/natid/sg.ts +39 -0
- package/src/detect/detectors/natid/si.ts +42 -0
- package/src/detect/detectors/natid/tr.ts +76 -0
- package/src/detect/detectors/natid/tw.ts +41 -0
- package/src/detect/detectors/natid/ua.ts +38 -0
- package/src/detect/detectors/natid/us.ts +118 -0
- package/src/detect/detectors/natid/za.ts +42 -0
- package/src/detect/detectors/secrets/apiKey.ts +115 -0
- package/src/detect/detectors/secrets/connectionString.ts +71 -0
- package/src/detect/detectors/secrets/genericSecret.ts +81 -0
- package/src/detect/detectors/secrets/index.ts +8 -0
- package/src/detect/detectors/secrets/jwt.ts +101 -0
- package/src/detect/detectors/secrets/pemPrivateKey.ts +59 -0
- package/src/detect/detectors/vat/euVat.ts +280 -0
- package/src/detect/detectors/vat/index.ts +4 -0
- package/src/detect/entropy.ts +60 -0
- package/src/detect/isoCountries.ts +30 -0
- package/src/detect/registry.ts +134 -0
- package/src/detect/runner.ts +187 -0
- package/src/detect/types.ts +296 -0
- package/src/encoding/base58.ts +85 -0
- package/src/encoding/base58monero.ts +90 -0
- package/src/encoding/bech32.ts +125 -0
- package/src/encoding/bytes.ts +48 -0
- package/src/entityFamily.ts +70 -0
- package/src/entityLabel.ts +56 -0
- package/src/entityTypes.ts +107 -0
- package/src/exposure/index.ts +189 -0
- package/src/fuse/calibrate.ts +224 -0
- package/src/fuse/defaultCalibration.ts +71 -0
- package/src/fuse/explain.ts +114 -0
- package/src/fuse/profiles.ts +187 -0
- package/src/fuse/resolve.ts +237 -0
- package/src/gazetteer/index.ts +139 -0
- package/src/generate/bankcodes.ts +82 -0
- package/src/generate/contact.ts +147 -0
- package/src/generate/crypto.ts +91 -0
- package/src/generate/documents.ts +142 -0
- package/src/generate/financial.ts +149 -0
- package/src/generate/index.ts +22 -0
- package/src/generate/location.ts +80 -0
- package/src/generate/natidAmOc.ts +198 -0
- package/src/generate/natidAsia.ts +162 -0
- package/src/generate/natidCee.ts +196 -0
- package/src/generate/natidMeCis.ts +131 -0
- package/src/generate/natidWest.ts +208 -0
- package/src/generate/prng.ts +17 -0
- package/src/generate/secrets.ts +141 -0
- package/src/generate/vat.ts +239 -0
- package/src/index.ts +186 -0
- package/src/mask/egressGuard.ts +88 -0
- package/src/mask/masker.ts +276 -0
- package/src/mask/restorer.ts +284 -0
- package/src/mask/surrogatePools.ts +96 -0
- package/src/mask/surrogates.ts +248 -0
- package/src/mask/vault.ts +153 -0
- package/src/ner/align.ts +86 -0
- package/src/ner/chunk.ts +65 -0
- package/src/ner/chunkCache.ts +110 -0
- package/src/ner/engine.ts +141 -0
- package/src/ner/merge.ts +123 -0
- package/src/ner/runStage2.ts +51 -0
- package/src/ner/stage2b.ts +73 -0
- package/src/ner/transformersClassifier.ts +79 -0
- package/src/ner/types.ts +99 -0
- package/src/normalization.ts +119 -0
- package/src/offsetMap.ts +271 -0
- package/src/pipeline.ts +96 -0
- package/src/protect.ts +284 -0
- package/src/scripts.ts +164 -0
- package/src/transforms/foldDigits.ts +138 -0
- package/src/transforms/graphemes.ts +5 -0
- package/src/transforms/homoglyphFold.ts +221 -0
- package/src/transforms/nfkc.ts +48 -0
- package/src/transforms/stripInvisibles.ts +158 -0
- package/src/transforms/whitespacePunct.ts +100 -0
- package/src/types.ts +339 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@discretion/core`.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
Versioning follows [VERSIONING.md](https://github.com/horozbabasi/discretion/blob/main/VERSIONING.md),
|
|
7
|
+
which is stricter than 0.x requires: **in 0.x, a minor bump is the breaking
|
|
8
|
+
one.**
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
Nothing yet.
|
|
13
|
+
|
|
14
|
+
## [0.1.0] — first published release
|
|
15
|
+
|
|
16
|
+
The engine has existed and been evaluated since well before this version; what
|
|
17
|
+
0.1.0 marks is the point at which it became usable as a standalone package
|
|
18
|
+
rather than as the extension's internals.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`protect(text, options)`** — the supported entry point. Runs Stages 0–4 in
|
|
23
|
+
the one order that is correct and returns the masked text, the findings,
|
|
24
|
+
an exposure score, and the vault needed to reverse it.
|
|
25
|
+
|
|
26
|
+
It exists because composing the pipeline by hand meant eight calls in a
|
|
27
|
+
specific order, an identity map held between two of them, and the fitted
|
|
28
|
+
calibration model imported from a second package through an unchecked cast.
|
|
29
|
+
Two of those orderings were bugs fixed in earlier milestones — resolving
|
|
30
|
+
overlaps *before* scoring exposure, and taking surrogates from the masker
|
|
31
|
+
rather than from `chooseSurrogate`, so that what is displayed is what is
|
|
32
|
+
substituted.
|
|
33
|
+
|
|
34
|
+
- **`ALL_ENTITY_TYPES`, `NER_ENTITY_TYPES`, `detectableEntityTypes()`** — a
|
|
35
|
+
runtime enumeration of the entity types, which a TypeScript union does not
|
|
36
|
+
have. `detectableEntityTypes()` is derived from the detector registry rather
|
|
37
|
+
than declared, so it cannot go stale: a type appears the moment something can
|
|
38
|
+
produce it.
|
|
39
|
+
|
|
40
|
+
- **`toCalibrationModel()`** — converts a fitted model to core's typed shape and
|
|
41
|
+
**reports** keys that are not entity types, replacing an
|
|
42
|
+
`as unknown as CalibrationModel` cast that would have hidden a stale key
|
|
43
|
+
while calibration silently fell back to the pooled curve.
|
|
44
|
+
|
|
45
|
+
- `exposureBand()`, `PersonPool`, `SeverityCategory` and
|
|
46
|
+
`GeneratedCalibrationModel` are now exported. The last three were named in
|
|
47
|
+
public signatures without being exported, so a consumer could receive one and
|
|
48
|
+
had no way to name its type.
|
|
49
|
+
|
|
50
|
+
- Runnable examples under `examples/`, executed against the packed tarball by
|
|
51
|
+
`scripts/verify-standalone-consumer.sh`, so the documentation cannot drift
|
|
52
|
+
from the package.
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- **`@huggingface/transformers` is now an optional peer dependency** rather
|
|
57
|
+
than a dependency. It is needed only for Stage 2, which is reached through
|
|
58
|
+
the separate `./ner-transformers` entry point, and it pulls in
|
|
59
|
+
`onnxruntime-node`. Installing the package in an empty project now produces
|
|
60
|
+
**20 MB of `node_modules`** instead of a little over 220 MB.
|
|
61
|
+
|
|
62
|
+
If you use Stage 2, add `@huggingface/transformers` to your own
|
|
63
|
+
dependencies.
|
|
64
|
+
|
|
65
|
+
- `@discretion/data` is pinned to an exact version instead of `*`, so core
|
|
66
|
+
and its data tables cannot drift apart across releases.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **API_KEY matches no longer swallow a trailing full stop.** The body charset
|
|
71
|
+
legitimately includes `.`, and the match ran on into sentence punctuation, so
|
|
72
|
+
a key at the end of a sentence and the same key mid-sentence were two
|
|
73
|
+
different values — which quietly broke the guarantee that a value seen twice
|
|
74
|
+
gets the same stand-in, and left the masked text missing its punctuation.
|
|
75
|
+
|
|
76
|
+
Measured, Stage 1 + Stage 2 over 2,611 documents and 6,645 ground-truth
|
|
77
|
+
entities:
|
|
78
|
+
|
|
79
|
+
| | before | after |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| API_KEY recall | 99.6% | **100.0%** |
|
|
82
|
+
| API_KEY F1 | 97.6% | **97.9%** |
|
|
83
|
+
| API_KEY false negatives | 2 | **0** |
|
|
84
|
+
| API_KEY false positives | 20 | 20 |
|
|
85
|
+
| GENERIC_SECRET false positives | 2,075 | 2,077 |
|
|
86
|
+
|
|
87
|
+
Two keys previously missed are now found. Two additional GENERIC_SECRET
|
|
88
|
+
false positives appear alongside them, in the same two Dutch documents.
|
|
89
|
+
GENERIC_SECRET's published precision, recall and F1 (2.0% / 56.8% / 3.8%)
|
|
90
|
+
are unchanged at one decimal place, and no other entity type moved at all.
|
|
91
|
+
|
|
92
|
+
**The mechanism behind those two extra false positives was not isolated.**
|
|
93
|
+
The direction is consistent with the shorter API_KEY span leaving text that
|
|
94
|
+
the generic high-entropy detector then matches, but that was not confirmed,
|
|
95
|
+
and it is recorded as unexplained rather than given a tidy reason.
|
|
96
|
+
|
|
97
|
+
### Removed
|
|
98
|
+
|
|
99
|
+
- `DetectionResult` and `StageTiming`. Both were declared as shapes for "later
|
|
100
|
+
milestones" and never implemented — no function returned one and nothing
|
|
101
|
+
referenced them. A type in a published API is a promise that something
|
|
102
|
+
produces it. Use `ProtectResult`, whose `stagesRun` is derived from what
|
|
103
|
+
actually ran.
|
|
104
|
+
|
|
105
|
+
### Known limitations
|
|
106
|
+
|
|
107
|
+
Published rather than smoothed; the full table is in
|
|
108
|
+
[BENCHMARKS.md](https://github.com/horozbabasi/discretion/blob/main/BENCHMARKS.md).
|
|
109
|
+
|
|
110
|
+
- `GENERIC_SECRET` recall is 56.8% and its precision is 2.0% before Stage 4
|
|
111
|
+
overlap resolution reassigns most of those matches to a specific type.
|
|
112
|
+
- `TAX_ID` precision is 46.0%; `DRIVERS_LICENSE`, `POSTAL_CODE`,
|
|
113
|
+
`US_ROUTING_NUMBER` and `URL_WITH_CREDENTIALS` are all below 40% precision.
|
|
114
|
+
- Stage 2 recognises `PERSON`, `ORG` and `LOCATION` only, and needs a model
|
|
115
|
+
this package does not ship.
|
|
116
|
+
- `DATE_OF_BIRTH` is in the `EntityType` union but nothing produces it; it is
|
|
117
|
+
correctly absent from `detectableEntityTypes()`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 horozbabasi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# @discretion/core
|
|
2
|
+
|
|
3
|
+
Finds sensitive values in text — credentials, card and bank numbers, national
|
|
4
|
+
and tax IDs, contact details, names — and replaces them with realistic
|
|
5
|
+
stand-ins you can reverse later.
|
|
6
|
+
|
|
7
|
+
It runs entirely in-process. **The package makes no network requests**, has no
|
|
8
|
+
DOM dependency and no Node built-in dependency, so the same code runs in
|
|
9
|
+
Node, a browser, a worker, Deno or Bun.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @discretion/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { protect, restore } from '@discretion/core';
|
|
21
|
+
|
|
22
|
+
const message = 'Wire it to DE44500105175407324931 and use key sk_live_7f3Kq2mNpX8vC1bWzR4tY6.';
|
|
23
|
+
|
|
24
|
+
const result = await protect(message, { seed: 42 });
|
|
25
|
+
|
|
26
|
+
console.log(result.maskedText);
|
|
27
|
+
// Wire it to DE47770612720573428586 and use key AIzauyqgh8Oh57cbKOykXCGFCF3tvgjsKhc_kVd.
|
|
28
|
+
|
|
29
|
+
console.log(result.entities.map((e) => `${e.type} -> ${e.surrogate}`));
|
|
30
|
+
// [ 'IBAN -> DE47770612720573428586', 'API_KEY -> AIzauyqgh8Oh57cbKOykXCGFCF3tvgjsKhc_kVd' ]
|
|
31
|
+
|
|
32
|
+
// Send result.maskedText wherever it needs to go. When the reply comes back:
|
|
33
|
+
console.log(restore(result.maskedText, result.vault).restoredText === message);
|
|
34
|
+
// true
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The surrogates are **format-preserving**: an IBAN is replaced by a different
|
|
38
|
+
IBAN that passes the same checksum, a card number by a card number that passes
|
|
39
|
+
Luhn. Text that had to look like an IBAN downstream still does.
|
|
40
|
+
|
|
41
|
+
The output above is what this actually prints with `seed: 42`. Drop the seed
|
|
42
|
+
and the stand-ins differ every run.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## What it detects
|
|
47
|
+
|
|
48
|
+
113 detectors across 34 entity types, in ten families: secrets, financial,
|
|
49
|
+
identity, health, document, contact, person, location, network, other.
|
|
50
|
+
|
|
51
|
+
Identifiers are **validated, not pattern-matched**. A card number must pass
|
|
52
|
+
Luhn, an IBAN must pass mod-97, a national ID must pass its own country's
|
|
53
|
+
check digit, a phone number must parse as a real number in some region. Then
|
|
54
|
+
the surrounding text is scored, so `sk_test_...` in a code fence is treated
|
|
55
|
+
differently from the same shape in a sentence about production.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import { detectableEntityTypes } from '@discretion/core';
|
|
59
|
+
|
|
60
|
+
console.log(detectableEntityTypes().length); // 34
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Confidence is **calibrated against a held-out set**, so 0.8 means roughly 80%
|
|
64
|
+
— expected calibration error 2.63%, against 12.33% for the raw scores. Full
|
|
65
|
+
per-type precision and recall are in
|
|
66
|
+
[BENCHMARKS.md](https://github.com/horozbabasi/discretion/blob/main/BENCHMARKS.md),
|
|
67
|
+
including the types that do badly.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## It fails closed, and that is your contract too
|
|
72
|
+
|
|
73
|
+
If a detector throws or detection times out, `protect()` **rejects**. It does
|
|
74
|
+
not return an empty result.
|
|
75
|
+
|
|
76
|
+
That is deliberate and it is the single most important thing to get right when
|
|
77
|
+
you integrate it:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
// WRONG. This turns every failure into "nothing sensitive here".
|
|
81
|
+
let result;
|
|
82
|
+
try {
|
|
83
|
+
result = await protect(message);
|
|
84
|
+
} catch {
|
|
85
|
+
result = { maskedText: message, entities: [] }; // ← now you send the original
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// RIGHT. Not being able to check is not the same as having checked.
|
|
89
|
+
const result = await protect(message); // let it throw, and stop
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Being unable to look is not evidence that there was nothing to find. If you
|
|
93
|
+
cannot mask, do not send.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Reversing it
|
|
98
|
+
|
|
99
|
+
`protect()` returns the `vault` that holds the originals. `restore()` needs it.
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import { protect, restore, Vault } from '@discretion/core';
|
|
103
|
+
|
|
104
|
+
// One vault across a whole conversation, so a value seen twice gets the same
|
|
105
|
+
// stand-in and a reply mentioning it can still be restored.
|
|
106
|
+
const vault = new Vault();
|
|
107
|
+
|
|
108
|
+
const first = await protect('My IBAN is DE44500105175407324931.', { vault });
|
|
109
|
+
const second = await protect('Again: DE44500105175407324931', { vault });
|
|
110
|
+
console.log(first.entities[0].surrogate === second.entities[0].surrogate); // true
|
|
111
|
+
|
|
112
|
+
const reply = `Received ${first.entities[0].surrogate}, thanks.`;
|
|
113
|
+
console.log(restore(reply, vault).restoredText);
|
|
114
|
+
// Received DE44500105175407324931, thanks.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The vault holds plaintext originals **in memory**. Do not serialise it to
|
|
118
|
+
disk, a database, or a log. If you keep one per user session, clear it when
|
|
119
|
+
the session ends.
|
|
120
|
+
|
|
121
|
+
For streamed responses use the `Restorer` class, which buffers across chunk
|
|
122
|
+
boundaries so a surrogate split between two chunks is still replaced:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
import { Restorer } from '@discretion/core';
|
|
126
|
+
|
|
127
|
+
const restorer = new Restorer(vault);
|
|
128
|
+
for await (const chunk of stream) process.stdout.write(restorer.push(chunk));
|
|
129
|
+
process.stdout.write(restorer.finish()); // the tail - do not drop it
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Choosing what gets reported
|
|
135
|
+
|
|
136
|
+
Three profiles, differing in which families they cover and how much confidence
|
|
137
|
+
they demand:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
await protect(message, { profile: 'minimal' }); // secrets and financial only
|
|
141
|
+
await protect(message, { profile: 'balanced' }); // default
|
|
142
|
+
await protect(message, { profile: 'strict' }); // adds health, location, orgs, dates
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Finer control:
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
await protect(message, {
|
|
149
|
+
// Never report these exact values; always report those.
|
|
150
|
+
lists: { allow: ['support@example.com'], deny: ['Project Gemstone'] },
|
|
151
|
+
|
|
152
|
+
// Turn individual types off.
|
|
153
|
+
typeAllowed: (type) => type !== 'PERSON',
|
|
154
|
+
|
|
155
|
+
// Needed for identifiers that are ambiguous without a country. A phone
|
|
156
|
+
// number in national form cannot be validated at all without this - it is
|
|
157
|
+
// not a confidence penalty, the detector reports nothing.
|
|
158
|
+
defaultRegion: 'DE',
|
|
159
|
+
|
|
160
|
+
// '[EMAIL_1]' style instead of realistic stand-ins.
|
|
161
|
+
mode: 'token',
|
|
162
|
+
|
|
163
|
+
// Fixed seed makes the run reproducible.
|
|
164
|
+
seed: 42,
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
A type excluded by `typeAllowed` is **not masked** — it is not reported and
|
|
169
|
+
not replaced. That is the honest consequence of switching it off.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Names, organisations and places (optional)
|
|
174
|
+
|
|
175
|
+
Stages 0, 1, 3 and 4 run with no model. Recognising *names* needs Stage 2, a
|
|
176
|
+
multilingual transformer that this package does **not** depend on, because it
|
|
177
|
+
pulls in the ONNX runtime — over 200 MB — and most callers do not need it.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm install @huggingface/transformers # only if you want Stage 2
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
import { protect, NerEngine } from '@discretion/core';
|
|
185
|
+
import { createTransformersClassifier } from '@discretion/core/ner-transformers';
|
|
186
|
+
|
|
187
|
+
const classifier = await createTransformersClassifier({
|
|
188
|
+
model: 'jiting/xlm-roberta-base-ner-hrl_onnx',
|
|
189
|
+
dtype: 'q8',
|
|
190
|
+
cacheDir: './models',
|
|
191
|
+
// Leave false in production and bundle the weights yourself. `protect()`
|
|
192
|
+
// never reaches the network; this flag is the one place the TOOLING can.
|
|
193
|
+
allowRemoteModels: false,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const ner = new NerEngine(classifier, { timeBudgetMs: 5_000 });
|
|
197
|
+
await ner.warmup();
|
|
198
|
+
|
|
199
|
+
const result = await protect(message, { ner });
|
|
200
|
+
console.log(result.stagesRun.includes('stage2-ner')); // true
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`stagesRun` is derived from what actually ran, not declared. If it does not
|
|
204
|
+
contain `'stage2-ner'`, names were not looked for — check it rather than
|
|
205
|
+
assuming.
|
|
206
|
+
|
|
207
|
+
Per-language F1 ranges from 82.0 (Japanese) to 96.4 (Ukrainian) across 25
|
|
208
|
+
languages; the model weights are not shipped in this package.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Adding your own detector
|
|
213
|
+
|
|
214
|
+
Adding one is a single object. It joins the same validation, context scoring
|
|
215
|
+
and fusion as the built-ins.
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
import { registerDetector, CONFIDENCE, GLOBAL_REGION, valid, invalid } from '@discretion/core';
|
|
219
|
+
|
|
220
|
+
registerDetector({
|
|
221
|
+
id: 'acme-employee-id',
|
|
222
|
+
entityType: 'NATIONAL_ID',
|
|
223
|
+
regions: [GLOBAL_REGION],
|
|
224
|
+
pattern: /\bACME-\d{7}\b/gu,
|
|
225
|
+
baseConfidence: CONFIDENCE.MEDIUM,
|
|
226
|
+
description: 'Acme internal employee number.',
|
|
227
|
+
validate: ({ match }) => {
|
|
228
|
+
const digits = match[0].slice('ACME-'.length);
|
|
229
|
+
const sum = [...digits].reduce((acc, d) => acc + Number(d), 0);
|
|
230
|
+
return sum % 7 === 0 ? valid({ confidence: CONFIDENCE.MAXIMUM }) : invalid('checksum');
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**`ctx.text` is the whole normalized document, not the matched substring.** The
|
|
236
|
+
match is `ctx.match[0]`, or `ctx.text.slice(ctx.start, ctx.end)`. Slicing
|
|
237
|
+
`ctx.text` as though it were the match is the easiest mistake to make here, and
|
|
238
|
+
it fails quietly: the validator rejects everything and the detector simply
|
|
239
|
+
never reports.
|
|
240
|
+
|
|
241
|
+
`entityType` must be an existing `EntityType`; the union is closed so that
|
|
242
|
+
profiles, severity weights and surrogate strategies stay total. Values of a
|
|
243
|
+
type with no format-preserving generator fall back to a bracket token
|
|
244
|
+
(`[NATIONAL_ID_1]`) rather than an invented stand-in.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Working with offsets
|
|
249
|
+
|
|
250
|
+
`protect()` handles this for you. If you use the lower-level stages, the rule
|
|
251
|
+
matters: detection runs on **normalized** text (invisible characters stripped,
|
|
252
|
+
NFKC applied, homoglyphs folded), and offsets into it are not offsets into
|
|
253
|
+
your original string.
|
|
254
|
+
|
|
255
|
+
```js
|
|
256
|
+
import { normalize, runStage1, mapNormalizedSpan } from '@discretion/core';
|
|
257
|
+
|
|
258
|
+
const normalization = normalize(original);
|
|
259
|
+
for (const candidate of runStage1(normalization, {})) {
|
|
260
|
+
// Widens correctly when a span lands inside an NFKC expansion. Never index
|
|
261
|
+
// the offset map directly for a range.
|
|
262
|
+
const [start, end] = mapNormalizedSpan(normalization, candidate.start, candidate.end);
|
|
263
|
+
console.log(original.slice(start, end));
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
`ProtectedEntity.originalStart` / `originalEnd` are already in the original
|
|
268
|
+
string's coordinates.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## What it will not do
|
|
273
|
+
|
|
274
|
+
- **It misses things.** `GENERIC_SECRET` recall is 55.4%; `TAX_ID` is 91.2%.
|
|
275
|
+
It is a safety net, not a guarantee, and it is not a compliance control.
|
|
276
|
+
- **It flags harmless things.** Review before acting on it in anything
|
|
277
|
+
automated.
|
|
278
|
+
- **It does not read files, images or PDFs.** Text in, text out.
|
|
279
|
+
- **It does not do structured redaction of documents** — no PDF or DOCX
|
|
280
|
+
rewriting, no bounding boxes.
|
|
281
|
+
- **It has no server component and never will.** There is nothing to
|
|
282
|
+
configure, no key, no account, and no request to block at your firewall.
|
|
283
|
+
|
|
284
|
+
The measured numbers behind all of this, including where it does badly, are
|
|
285
|
+
published in
|
|
286
|
+
[BENCHMARKS.md](https://github.com/horozbabasi/discretion/blob/main/BENCHMARKS.md).
|
|
287
|
+
Nothing above is asserted without a measurement behind it.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Performance
|
|
292
|
+
|
|
293
|
+
On the reference machine, Stages 0–3 over a 2 KB document: **p50 10.6 ms**.
|
|
294
|
+
With Stage 2 enabled: **p50 255.8 ms**, almost all of it inference.
|
|
295
|
+
|
|
296
|
+
Measured with a machine-health canary that marks a run degraded when the
|
|
297
|
+
machine itself is slow, so published figures are not compared against numbers
|
|
298
|
+
taken under load. See
|
|
299
|
+
[BENCHMARKS.md](https://github.com/horozbabasi/discretion/blob/main/BENCHMARKS.md).
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## API surface and stability
|
|
304
|
+
|
|
305
|
+
`protect()` is the supported entry point. Every pipeline stage is also
|
|
306
|
+
exported for callers who want one — `normalize`, `runStage1`, `detect`,
|
|
307
|
+
`resolveOverlaps`, `calibrate`, `decide`, `maskOriginal`, `computeExposure`.
|
|
308
|
+
|
|
309
|
+
`mask()` is **not** a smaller `protect()`. It runs Stage 1 only, with no
|
|
310
|
+
context scoring, calibration or profile decision. It exists for the Stage-1
|
|
311
|
+
baseline in the evaluation harness.
|
|
312
|
+
|
|
313
|
+
Versioning policy, including what 0.x means here:
|
|
314
|
+
[VERSIONING.md](https://github.com/horozbabasi/discretion/blob/main/VERSIONING.md).
|
|
315
|
+
|
|
316
|
+
## Licence
|
|
317
|
+
|
|
318
|
+
MIT. Unicode data under the Unicode licence — see `THIRD_PARTY_NOTICES.md` in
|
|
319
|
+
`@discretion/data`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ABA routing transit number checksum (US_ROUTING_NUMBER).
|
|
3
|
+
*
|
|
4
|
+
* A nine-digit number whose positional weights cycle 3, 7, 1. The number is
|
|
5
|
+
* valid when the weighted sum is divisible by 10.
|
|
6
|
+
*
|
|
7
|
+
* Kept in its own module rather than inlined in the detector because the same
|
|
8
|
+
* 3-7-1 pattern appears in other North American banking identifiers, and
|
|
9
|
+
* because "which weight goes first" is exactly the kind of detail that is
|
|
10
|
+
* worth pinning with its own tests.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Validate a nine-digit ABA routing number.
|
|
14
|
+
*
|
|
15
|
+
* Length is enforced here because the checksum alone is weak — a shorter or
|
|
16
|
+
* longer digit run can satisfy it by chance, and every real routing number is
|
|
17
|
+
* exactly nine digits.
|
|
18
|
+
*/
|
|
19
|
+
export declare function abaValid(value: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The final ABA check digit for the first eight digits of a routing number.
|
|
22
|
+
* Returns `null` if the payload is not exactly eight digits.
|
|
23
|
+
*/
|
|
24
|
+
export declare function abaCheckDigit(payload: string): number | null;
|
|
25
|
+
//# sourceMappingURL=aba.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aba.d.ts","sourceRoot":"","sources":["../../../src/checksums/aba.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK/C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ABA routing transit number checksum (US_ROUTING_NUMBER).
|
|
3
|
+
*
|
|
4
|
+
* A nine-digit number whose positional weights cycle 3, 7, 1. The number is
|
|
5
|
+
* valid when the weighted sum is divisible by 10.
|
|
6
|
+
*
|
|
7
|
+
* Kept in its own module rather than inlined in the detector because the same
|
|
8
|
+
* 3-7-1 pattern appears in other North American banking identifiers, and
|
|
9
|
+
* because "which weight goes first" is exactly the kind of detail that is
|
|
10
|
+
* worth pinning with its own tests.
|
|
11
|
+
*/
|
|
12
|
+
import { toDigits } from './digits.js';
|
|
13
|
+
import { cyclicWeightedMod } from './weighted.js';
|
|
14
|
+
/** ABA positional weights, cycling across the nine digits. */
|
|
15
|
+
const ABA_WEIGHTS = [3, 7, 1];
|
|
16
|
+
/**
|
|
17
|
+
* Validate a nine-digit ABA routing number.
|
|
18
|
+
*
|
|
19
|
+
* Length is enforced here because the checksum alone is weak — a shorter or
|
|
20
|
+
* longer digit run can satisfy it by chance, and every real routing number is
|
|
21
|
+
* exactly nine digits.
|
|
22
|
+
*/
|
|
23
|
+
export function abaValid(value) {
|
|
24
|
+
if (value.length !== 9)
|
|
25
|
+
return false;
|
|
26
|
+
const digits = toDigits(value);
|
|
27
|
+
if (digits === null)
|
|
28
|
+
return false;
|
|
29
|
+
return cyclicWeightedMod(digits, ABA_WEIGHTS, 10) === 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The final ABA check digit for the first eight digits of a routing number.
|
|
33
|
+
* Returns `null` if the payload is not exactly eight digits.
|
|
34
|
+
*/
|
|
35
|
+
export function abaCheckDigit(payload) {
|
|
36
|
+
if (payload.length !== 8)
|
|
37
|
+
return null;
|
|
38
|
+
const digits = toDigits(payload);
|
|
39
|
+
if (digits === null)
|
|
40
|
+
return null;
|
|
41
|
+
const partial = cyclicWeightedMod(digits, ABA_WEIGHTS, 10);
|
|
42
|
+
if (partial === null)
|
|
43
|
+
return null;
|
|
44
|
+
// The ninth position carries weight 1 (index 8 → 8 % 3 === 2 → weight 1).
|
|
45
|
+
return (10 - partial) % 10;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=aba.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aba.js","sourceRoot":"","sources":["../../../src/checksums/aba.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,8DAA8D;AAC9D,MAAM,WAAW,GAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClC,OAAO,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IAC3D,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Digit and character helpers shared by every checksum implementation.
|
|
3
|
+
*
|
|
4
|
+
* These exist so that the algorithm modules (luhn, mod97, verhoeff, …) deal
|
|
5
|
+
* only in `number[]` and never re-implement parsing. Every function here is
|
|
6
|
+
* total: it returns `null` on malformed input rather than throwing, because
|
|
7
|
+
* checksum code runs on arbitrary user text where malformed input is the
|
|
8
|
+
* common case, not an exceptional one.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Parse a string of ASCII digits into numeric digit values.
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` if the string is empty or contains any non-digit character.
|
|
14
|
+
* Deliberately rejects non-ASCII digits (Arabic-Indic ٤, fullwidth 4, …):
|
|
15
|
+
* Stage 0 normalization already folds fullwidth forms to ASCII, and a
|
|
16
|
+
* genuinely non-ASCII digit run is not an identifier in any scheme we
|
|
17
|
+
* validate.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toDigits(value: string): number[] | null;
|
|
20
|
+
/**
|
|
21
|
+
* Remove every character in `separators` from `value`.
|
|
22
|
+
*
|
|
23
|
+
* Identifiers are routinely written with grouping punctuation (`4111 1111
|
|
24
|
+
* 1111 1111`, `123-45-6789`, `AB-12-CD`). Detectors strip before validating
|
|
25
|
+
* and keep the raw span for offset reporting.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stripSeparators(value: string, separators?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Value of an alphanumeric character in base 36: '0'–'9' → 0–9,
|
|
30
|
+
* 'A'/'a'–'Z'/'z' → 10–35. Returns `null` for anything else.
|
|
31
|
+
*
|
|
32
|
+
* This is the mapping IBAN's mod-97 and several VAT schemes use to fold
|
|
33
|
+
* letters into the numeric checksum.
|
|
34
|
+
*/
|
|
35
|
+
export declare function alphanumericValue(ch: string): number | null;
|
|
36
|
+
/**
|
|
37
|
+
* Expand every character of `value` to its base-36 value and concatenate the
|
|
38
|
+
* decimal representations, the transformation IBAN mod-97 requires.
|
|
39
|
+
*
|
|
40
|
+
* "GB82" → "161182" (G=16, B=11, 8, 2)
|
|
41
|
+
*
|
|
42
|
+
* Returns `null` if any character is not alphanumeric.
|
|
43
|
+
*/
|
|
44
|
+
export declare function toNumericString(value: string): string | null;
|
|
45
|
+
/** True when every character is an ASCII digit and the string is non-empty. */
|
|
46
|
+
export declare function isAllDigits(value: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* True when every digit is identical ("0000000000", "1111111111").
|
|
49
|
+
*
|
|
50
|
+
* Repdigits pass several national checksums by construction (a weighted sum
|
|
51
|
+
* of identical digits often lands on a valid remainder) yet are never issued.
|
|
52
|
+
* Schemes that exclude them say so in their own validator.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isRepdigit(digits: readonly number[]): boolean;
|
|
55
|
+
//# sourceMappingURL=digits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digits.d.ts","sourceRoot":"","sources":["../../../src/checksums/digits.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CASvD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,SAAa,GAAG,MAAM,CAM9E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO3D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAO7D"}
|