Skip to content

Releases: ActiveLogin/ActiveLogin.Identity

3.0.0

09 Feb 09:29
63824ae
Compare
Choose a tag to compare

New features

CoordinationNumber

CoordinationNumber provides parsing methods such as CoordinationNumber.Parse() and CoordinationNumber.TryParse() that can be used like this:

var rawCoordinationNumber = "680164-2395";
if (CoordinationNumber.TryParse(rawCoordinationNumber, out var coordinationNumber))
{
    Console.WriteLine("CoordinationNumber");
    Console.WriteLine(" .ToString(): {0}", coordinationNumber.ToString());
    Console.WriteLine(" .To10DigitString(): {0}", coordinationNumber.To10DigitString());
    Console.WriteLine(" .To12DigitString(): {0}", coordinationNumber.To12DigitString());
    Console.WriteLine(" .RealDay: {0}", coordinationNumber.RealDay;

    Console.WriteLine(" .GetDateOfBirthHint(): {0}", coordinationNumber.GetDateOfBirthHint().ToShortDateString());
    Console.WriteLine(" .GetAgeHint(): {0}", coordinationNumber.GetAgeHint().ToString());

    Console.WriteLine(" .GetGenderHint(): {0}", coordinationNumber.GetGenderHint().ToString());
    
    // IsTestNumber is an extension method from the package ActiveLogin.Identity.Swedish.TestData
    Console.WriteLine(" .IsTestNumber(): {0}", coordinationNumber.IsTestNumber().ToString());
}
else
{
    Console.Error.WriteLine("Unable to parse the input as a CoordinationNumber.");
}

The code above would output (as of 2018-07-23):

CoordinationNumber
 .ToString(): 199908072391
 .To10DigitString(): 990807-2391
 .To12DigitString(): 199908072391
 .RealDay: 7
 .GetDateOfBirthHint(): 1999-08-07
 .GetAgeHint(): 18
 .GetGenderHint(): Male
 .IsTestNumber(): True

CoordinationNumberTestData

We also provides testdata for CoordinationNumber.

using ActiveLogin.Identity.Swedish.TestData; 

var aTestNumber = CoordinationNumberTestData.GetRandom();
aTestNumber.IsTestNumber(); // => true

StrictMode

The library can be configured to use different levels 'strictness' when parsing identity numbers. The different levels are:

  • Off
  • Ten Digits
  • Twelve Digits
  • Ten or Twelve Digits

By default 'Ten or Twelve Digits' is used but it can be overridden when calling Parse and TryParse, e.g.:

// this would fail since the input is not a 12 digit number.
PersonalIdentityNumber.Parse("990807-2391", StrictMode.TwelveDigits); 

Breaking changes

Strict mode

Up until now the parsing of personal identity number have been very allowing. We think there are scenarios where this is still relevant, but from now on by default it will be more strict and only allow the most common patterns (10 or 12 digits). This behaviour can be changed by changing the StrictMode. See details in Readme.

   PersonalIdentityNumber.Parse("990807-2391", StrictMode.Off); 

Removing "Swedish" prefix

The prefix "Swedish" have been removed from SwedishPersonalIdentityNumber, so now it is just "PersonalIdentityNumber".

What's Changed

New Contributors

Full Changelog: 2.0.2...3.0.0

Testdata 1.0.0

06 Sep 14:16
f8913d4
Compare
Choose a tag to compare

Initial release of the Testdata package in version 1.0.0.

Identity 2.0.2

06 Sep 13:59
5e12d79
Compare
Choose a tag to compare
Add more samples on IsTestNumber

Identity 2.0.1

03 Feb 12:18
Compare
Choose a tag to compare

Minor release to fix issue when comparing to null using == or !== operator.

  • Fix: Add missing nullcheck for equality test #73

Identity 2.0.0

31 Jan 23:20
e4902a7
Compare
Choose a tag to compare

This release has some breaking changes, including allowing to parse more vatiations of personal identity numbers.

  • Feature: Clean input before parsing to allow more input variations (#64)
  • Breaking change: Use constructor instead of Create (#67)
  • Breaking change: Move Hint-extensions to a new namespace (#70)
  • Fix: Bug in for getAgeHint (#60)
  • Fix: Handle parsing of null, whitespace and empty string (#61)

Identity 1.0.0: Initial stable release

19 Dec 12:40
5759848
Compare
Choose a tag to compare

ActiveLogin.Identity provides parsing and validation of Swedish identities such as Personal Identity Number (svenskt personnummer). Built on NET Standard and packaged as NuGet-packages they are easy to install and use on multiple platforms.