ministero-salute / it-dgc-verificac19-sdk-android

Digital Covid Certificate SDK
Apache License 2.0
57 stars 29 forks source link

Singapore issued Certificate with no given/family names #119

Closed wolfAle closed 2 years ago

wolfAle commented 2 years ago

Hi,

I run into an issue while validating a Singapore issued certificate. The QRCode is validated and accepted, but it doesn't read the Given Name and Family Name of the owner. With some debugging I found out that:

"nam" : {
    "fnt" : "NAME<OTHERNAME<ANOTHERNAME<SOMANYNAMES"
  },

The problem is that there's nothing in the fn and gn fields. This creates some issues on our side because we rely on those values to trigger some other validations.

Expected behaviour

A Family Name and a Given Name to be provided, given that there actually is a "fnt".

Steps to reproduce the issue

I don't think I'm allowed, nor it would be safe, to share the original QRCode :-/

Technical details

Thanks Alessandro

p.s: I posted the same thing in the iOS repos, with no luck. https://github.com/ministero-salute/it-dgc-verificaC19-ios/issues/136

rawmain commented 2 years ago

Hello @wolfAle

I run into an issue while validating a Singapore issued certificate. The QRCode is validated and accepted, but it doesn't read the Given Name and Family Name of the owner. With some debugging I found out that: [...] The problem is that there's nothing in the fn and gn fields. This creates some issues on our side because we rely on those values to trigger some other validations.

Sorry for the late reply.

It isn't a decoder / DGC-SDK issue, but is related instead to the app/UI function, that arranges the person details into the validation output.

I've just submitted the related PR 257 into the Android whitelabel-app repo.

Such Commit/fix can be easily replicated into 3rd party apps, since it just requires to perform a null/empty check against the fn field.

    private fun setPersonData(person: PersonModel?, dateOfBirth: String?) {
        if (person?.familyName.isNullOrEmpty()) {
            binding.nameStandardisedText.text = person?.standardisedFamilyName.plus(" ").plus(person?.standardisedGivenName).plus(" ").plus(person?.givenName)
         } else {
            binding.nameStandardisedText.text = person?.familyName.plus(" ").plus(person?.givenName)
        }
        binding.birthdateText.text = dateOfBirth?.formatDateOfBirth().orEmpty()
    }

Now checking the current develop + feature code into the iOS verifier-app repo in order to submit a similar PR for iOS app/UI management too.