HermannBjorgvin / Kennitala

Icelandic national ID (kennitölur) utilities for servers and clients.
MIT License
36 stars 10 forks source link

Random numbers below 20 are considered valid #22

Closed MiniGod closed 1 week ago

MiniGod commented 2 years ago

In #6 you confirmed that the 7-8th digit should start at 20, and fixed the generator.

But isPerson returns true for the 7-8th numbers below 20.

For instance 070222-0000 returns true, but is invalid.

HermannBjorgvin commented 2 years ago

I think we discussed this before, the 7-8th numbers start at 20 right now but I think that is a decision by Þjóðskrá, so maybe in the future they decide to start counting at 00 and I'm not sure they will let anyone know.

We could have a min 20 requirement, the advantage would be a stricter validation.

Probably worth it to add this then.

MiniGod commented 2 years ago

Since the generator starts at 20, I think the validator should do the same.

HermannBjorgvin commented 2 years ago

Yeah I think we'll do that, if Þjóðskrá changes the way they generate Kennitölur it will be a huge breaking change anyway so a version bump wouldn't be the worst result in that case. The big advantage is stricter validation. Lets go for it.

I'll have time over the weekend to implement a couple of the fixes for V1 and then I need to publish V2 soon so people can start validating system Id's.

HermannBjorgvin commented 2 years ago

This is fixed in V2, there is a beta version available now on the v2.0.0-beta.0 version.

yarn add kennitala@2.0.0-beta.0

HermannBjorgvin commented 1 week ago

Available in V2.0.2 now non-beta.