Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
norwegian-national-id-validator
Advanced tools
Validate Norwegian national identity numbers (birth number (fødselsnummer), D-number, H-number and FH-number).
The NPM module is ES5, but TypeScript and Flow types is also exported. Types for Flow is generated with Flowgen.
Install the package via npm
:
npm install --save norwegian-national-id-validator
or
yarn add norwegian-national-id-validator
This package exports a functional and object-oriented API for your convenience.
import { NorwegianId } from 'norwegian-national-id-validator';
const validation = NorwegianId('29029600013');
console.log(validation.isValid())
// => true
console.log(validation.isBirthNumber())
// => true
console.log(validation.isDNumber())
// => false
console.log(validation.isHNumber())
// => false
console.log(validation.isFhNumber())
// => false
console.log(validation.isMale())
// => false
console.log(validation.isFemale())
// => true
console.log(validation.age())
// => 24
console.log(validation.birthDate())
// => Thu Feb 29 1996 [...]
This function checks if the given value is a valid Norwegian national identity number. Returns true
for valid, and false
for invalid ID-number.
Examples
import { validateNorwegianIdNumber } from 'norwegian-national-id-validator';
validateNorwegianIdNumber('29029900157');
// => false
validateNorwegianIdNumber('29029600013');
// => true
This function returns the age of a person with given Norwegian national identity number.
Returns undefined
when birth date could not be determined (e.g. for FH-numbers and invalid ID-numbers).
Examples
import { possibleAgeOfPersonWithIdNumber } from 'norwegian-national-id-validator';
possibleAgeOfPersonWithIdNumber('03111590925');
// => 1
possibleAgeOfPersonWithIdNumber('03110175225');
// => 15
Apart from this README, you can find details and examples of using the SDK in the following places:
To run the tests for this module:
npm test
Censorbot by Vipps
Censorbot looks for patterns in numbers containing 11 digits posted in Slack, using this package.
ng-input-validators
Code samples for Angular.
cobraz/norwegian-ssn-graphql-scalar
Custom GraphQL scalar type that utilizes this library.
FAQs
Validate norwegian national identity numbers
The npm package norwegian-national-id-validator receives a total of 6,019 weekly downloads. As such, norwegian-national-id-validator popularity was classified as popular.
We found that norwegian-national-id-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.