a simple validator for validation a norwegian social security numbers (FNR, DNR)
See Fødselsnummer for more info on how validation of a norwegian social security number is done
Supports the following synthetic numbers:
- Norsk Helsenett(nhn)
- Tenor (skatteetaten)
- Dolly (Nav)
- Kotlin
- Gradle
- JDK 25
Note Find the newest version of the libary here: https://central.sonatype.com/artifact/io.github.mikaojk/norwegian-social-security-number-validator and swap it out with the version(2.0.9) in the examples below
Gradle
implementation("io.github.mikaojk:norwegian-social-security-number-validator:2.0.9")
Maven
<dependency>
<groupId>io.github.mikaojk</groupId>
<artifactId>norwegian-social-security-number-validator</artifactId>
<version>2.0.9</version>
</dependency>
val validSocialSecurityNumber = validateSocialSecurityNumber("01013999900")
if (validSocialSecurityNumber) {
println("valid social securityNumber")
} else {
println("illegal social securityNumber")
}Make sure you have the Java JDK 25 installed You can check which version you have installed using this command:
java -versionTo build locally and run the integration tests you can simply run
./gradlew clean buildor on windows
gradlew.bat clean build
Find the newest version of gradle here: https://gradle.org/releases/ Then run this command:
./gradlew wrapper --gradle-version $gradleVersjonArtifact publish is done by GitHub Actions, and published to Maven Central
This project is maintained by CODEOWNERS
Questions and/or feature requests? Please create an issue
To get started, please fork the repo and checkout a new branch. See more info in CONTRIBUTING.md