Releases: ActiveLogin/ActiveLogin.Identity
3.0.0
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
- Update readme with link to TestData nuget-package by @viktorvan in #82
- Basic editorconfig file by @Zonnex in #81
- Update bug issue template by @viktorvan in #83
- Remove beta suffix from testdata package by @PeterOrneholm in #88
- Update runtime versions of samples and tests to core 3.0 by @PeterOrneholm in #91
- Add F#-tests by @viktorvan in #90
- Set up CI with Azure Pipelines by @PeterOrneholm in #99
- Make CI-build fail if there are focused tests by @viktorvan in #101
- Cleanup project files by @PeterOrneholm in #102
- Add C#8 nullable to csproj by @PeterOrneholm in #107
- Add sponsor info and support info by @PeterOrneholm in #106
- Implement support for CoordinationNumber. by @viktorvan in #97
- Add test data for C# api for coordination number. by @viktorvan in #114
- Update C# sample(s) by @PeterOrneholm in #113
- Update docs by @PeterOrneholm in #115
- Bump version to Core 3.1 by @PeterOrneholm in #117
- Feature/new fsharp api by @viktorvan in #116
- Add missing inequality operator. by @viktorvan in #121
- Feature/less strict coordination number by @viktorvan in #123
- Update docs by @PeterOrneholm in #124
- Return IEnumerable instead of FSharpList. by @viktorvan in #129
- Move extensions IsTestNumber to namespace ActiveLogin.Identity.Swedish. by @viktorvan in #130
- Feature/latest coordination number requirements by @viktorvan in #132
- Fix coordination-number zero day bug by @viktorvan in #134
- Feature/latest coordination number requirements by @viktorvan in #133
- Remove 'Swedish' prefix from types. by @viktorvan in #135
- Use timestamper url from environment by @PeterOrneholm in #138
- Feature/coordinationnumber hints by @viktorvan in #136
- Feature/remove eager initialization in testdata by @viktorvan in #137
- Add new stricter modes for parsing Identity Numbers by @viktorvan in #141
- Bump to version 3 by @viktorvan in #143
- Change master into main by @PeterOrneholm in #144
- Change from Slack to GitHub discussions in docs by @PeterOrneholm in #145
New Contributors
Full Changelog: 2.0.2...3.0.0
Testdata 1.0.0
Initial release of the Testdata package in version 1.0.0.
Identity 2.0.2
Add more samples on IsTestNumber
Identity 2.0.1
Minor release to fix issue when comparing to null using == or !== operator.
- Fix: Add missing nullcheck for equality test #73
Identity 2.0.0
This release has some breaking changes, including allowing to parse more vatiations of personal identity numbers.
Identity 1.0.0: Initial stable release
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.