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.
dev.personnummer:personnummer
Advanced tools
personnummer is a small open-source project that validates, formatting and determine sex and age from swedish personal identity numbers
Validate Swedish personal identity numbers.
Add the package to your maven or gradle configuration.
If you prefer to use the package from github rather than maven-central,
add the repository as well.
<dependency>
<groupId>dev.personnummer</groupId>
<artifactId>personnummer</artifactId>
<version>3.*.*</version>
</dependency>
plugins {
id 'maven'
}
repositories {
// If using maven central
mavenCentral()
// If you wish to use github
maven {
url "https://github.com/personnummer/java:personnummer"
}
}
dependencies {
configuration("dev.personnummer:personnummer")
}
For more information on how to install and authenticate with github packages, check this link.
import dev.personnummer.*;
class Test
{
public void TestValidation()
{
Personnummer.valid("191212121212"); // => True
Personnummer.valid("121212+1212"); // => True
Personnummer.valid("20121212-1212"); // => True
}
}
// Short format (YYMMDD-XXXX)
(new Personnummer("1212121212")).format();
// => 121212-1212
// Short format for 100+ years old
(new Personnummer("191212121212")).format();
//=> 121212+1212
// Long format (YYYYMMDDXXXX)
Personnummer.parse("1212121212").format(true);
//=> 201212121212
(new Personnummer("1212121212")).getAge();
//=> 7
(new Personnummer("1212121212")).isMale();
//=> true
Personnummer.parse("1212121212").isFemale();
//=> false
(new Personnummer("1212121212")).getDate();
//=> 2012-12-12T00:00
(new Personnummer("9001010017")).getDate();
//=> 1990-01-01T00:00
See src/test//PersonnummerTest.java
for more examples.
FAQs
Unknown package
We found that dev.personnummer:personnummer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.