Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
tin-validator
Advanced tools
Validate and mask a U.S. Taxpayer Identification Number (TIN). A TIN may be an Employer Identification Number (EIN), an Individual Taxpayer Identification Number (ITIN) or a Social Security number (SSN).
Install the package via npm
:
npm install tin-validator --save
isValid(value)
This method validates if the given value is a valid Taxpayer Identification Number
.
value
(*): The value to validate.(boolean): Returns whether the input value is a valid TIN or not.
isValid({});
// => false
isValid('9-0-0700000');
// => false
isValid('900-70-0000');
// => true
isValid('900700000');
// => true
mask(value)
This method will help you protect this sensitive piece of information by obfuscating some digits.
value
(*): The value to mask.(string): Returns the masked value by replacing value certain digits by 'X'.
mask({});
// Throws an Error.
mask('9-0-0700000');
// Throws an Error.
mask('900-70-0000');
// => XXX-XX-0000
mask('900700000');
// => XXXXX0000
sanitize(value)
This method will remove all non numeric characters from the value.
value
(*): The value to sanitize.(string): Returns the sanitized value containing only numeric characters.
sanitize('9-0 0700000');
// => 900700000
sanitize('900a7#$0foobar0000');
// => 900700000
To test using a local installation of node.js
:
npm test
To test using Docker exclusively:
docker-compose run --rm sut
npm version [<newversion> | major | minor | patch] --message "Release %s"
MIT
1.1.0 (2022-11-30)
FAQs
Taxpayer Identification Number validator and masker
The npm package tin-validator receives a total of 7,533 weekly downloads. As such, tin-validator popularity was classified as popular.
We found that tin-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.