Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
com.github.reducktion:socrates-java
Advanced tools
Socrates allows you to validate and retrieve personal data from National Identification Numbers across the world.
This package is a port of the php package socrates.
socrates-java allows you to validate and retrieve personal data from National Identification Numbers across the world, with the goal of eventually supporting as many countries in the world as possible.
Some countries also encode personal information of the citizen, such as gender or the place of birth. This package allows you to extract that information in a consistent way.
It can be useful for many things, such as validating a user's ID for finance related applications or verifying a user's age without asking for it explicitly. However, we recommend you review your country's data protection laws before storing any information.
Socrates provides two methods:
validateId
, which returns a boolean indicating if an id is valid in a specific countryextractCitizenFromId
, which returns an Optional Citizen
with information retrievable from the identifier (gender, date of birth, ...)You can find a list of supported countries here.
final Socrates socrates = new Socrates();
socrates.validateId("15420355 6 ZX9", Country.PT); // true
final Socrates socrates = new Socrates();
final Optional<Citizen> citizen = socrates.extractCitizenFromId("2820819398814 09", Country.FR);
citizen.ifPresent(c -> {
c.getGender().ifPresent(System.out::println); // "FEMALE"
c.getYearOfBirth().ifPresent(System.out::println); // "1982"
c.getMonthOfBirth().ifPresent(System.out::println); // "8"
c.getDayOfBirth().ifPresent(System.out::println);
c.getPlaceOfBirth().ifPresent(System.out::println); // "Corrèze"
});
Gender
is an enum that represents the gender of the Citizen
extracted from the ID. It can have the values FEMALE
or MALE
. However, you can get the
short hand "F" and "M" for FEMALE
and MALE
respectively, by using the method getShortHand()
present in the class.
Did you find a problem in any of the algorithms? Do you know how to implement a country which we have missed? Are there any improvements that you think should be made to the codebase? Any help is appreciated! Take a look at our contributing guidelines.
The MIT License (MIT). Please see License File for more information.
FAQs
Unknown package
We found that com.github.reducktion:socrates-java demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.