diggsweden / dgc-java

Java implementation of the EU eHealth Digital Green Certificates.
MIT License
27 stars 25 forks source link

Incorrect Instant serialization to JSON #66

Closed jozemlakar closed 3 years ago

jozemlakar commented 3 years ago

We are using dgc-java in Slovenia, forked at https://github.com/ixtlan-team/dgc-java We have prepared the DGCs and found that for "test" DGCs that include sc field, we get a value of: "sc": "2021-06-04T10:46:25.619935900Z" This value is not well recieved by the verification app, as fraction has too many digits (9). We have also found that in samples submitted by SE, value is '"sc": "2021-06-02T06:02:13.262564Z"' This value is correct, it has 6 digits in fraction.

You can disregard this issue and mark it closed and we will try and resolve the issue on our own. But if you feel that you want this resolved for you as well, then let us know, what the preffered way would be.

From what we found the correct way would be to fix the 'ObjectMapper jsonMapper' in 'DigitalCovidCertificate'. Alternative would be to add JsonFormatter to the Instant field in 'TestStatement'

martin-lindstrom commented 3 years ago

@jozemlakar Thanks for pointing it out. The PR https://github.com/DIGGSweden/dgc-java/pull/67 fixes this.

jozemlakar commented 3 years ago

PR #67 removes all fractions. As test show, it should hold EXACTLY 6 digits for fractions.

martin-lindstrom commented 3 years ago

6 fractions? From where did you get that information?

From the specification:

The date and time when the test sample was collected. The time MUST include information on the time zone. The value MUST NOT denote the time when the test result was produced.

Exactly 1 (one) non-empty field MUST be provided.

One of the following ISO 8601 formats MUST be used. Other options are not supported.

YYYY-MM-DDThh:mm:ssZ 
YYYY-MM-DDThh:mm:ss[+-]hh 
YYYY-MM-DDThh:mm:ss[+-]hhmm 
YYYY-MM-DDThh:mm:ss[+-]hh:mm 

Examples:

"sc": "2021-08-20T10:03:12Z"    (UTC time) 
"sc": "2021-08-20T12:03:12+02"  (CEST time) 
"sc": "2021-08-20T12:03:12+0200"    (CEST time) 
"sc": "2021-08-20T12:03:12+02:00"   (CEST time) 
jozemlakar commented 3 years ago

Yes, I am aware of the spec. However test on dgc-testdata denied samples with 0 fraction digits. Tests might be wrong.

martin-lindstrom commented 3 years ago

It’s not the first time they are wrong. I’ll bring it up with them.

7 juni 2021 kl. 21:03 skrev Jože Mlakar @.***>:

 Yes, I am aware of the spec. However test on dgc-testdata denied samples with 0 fraction digits. Tests might be wrong.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.