AndyQ / NFCPassportReader

NFCPassportReader for iOS 13
MIT License
733 stars 235 forks source link

Fails on chinese passport #202

Open iAbdul opened 6 months ago

iAbdul commented 6 months ago

Hi, Code works good with Canadian and usa passport however it fails with Chinese passport and shows alert "unsupported data group". Can you guide me how to make it work on Chinese passport. Thanks!

TerjeLon commented 3 months ago

Not all passports follow the ICAO standard regarding listing Datagroups in the COM's 5C tag. They actually list some elements in the COM 5C tag that is not in the ICAO-standard.

This should perhaps not give an error, as reading the passport itself should be fine.

Perhaps a solution here could be to return the PassportModel in the callback instead of an error, and add a "warning/errors" parameter to the Model so consumers can be notified of the deviations that has occured.

So what actually happens here is that a DG-group is listed in the COM, but it does not actually exist. So it should be skipped instead of throwing

advatar commented 3 months ago

I have noticed this too. There can be 19 DataGroups but the app only supports to 16. Try and add DG17-19 with no parsing.

TerjeLon commented 3 months ago

I have noticed this too. There can be 19 DataGroups but the app only supports to 16. Try and add DG17-19 with no parsing.

Theres no official documentation on those datagroups.

i will try to create a pr for this when i have the time

TerjeLon commented 3 months ago

@iAbdul could you try again with the branch on the PR above and see if this fixes it for you? @advatar did you have any documents you could try on? Testing is much appreciated as i dont have any documents on hand.

Please comment in the PR so that if/when @AndyQ eventually gets around to it he can see that the fix is verified.