Skip to content

Commit

Permalink
Merge pull request #28 from lucadentella/feat/official-sdk
Browse files Browse the repository at this point in the history
Feat/official sdk
  • Loading branch information
lucadentella authored Dec 18, 2021
2 parents 2c7bbaf + e729218 commit b2ccacc
Show file tree
Hide file tree
Showing 13 changed files with 839 additions and 411 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ Raspberry appliance to verify EU [Digital Green Certificates](https://ec.europa.

## What's new :tada:

- 18/12/2021, new major version, with **official SDK**, **Super DGC** and **scheduled updates**
- 07/11/2021, check italian **UVCI blacklist**
- 07/11/2021, accept Sputnik-V for **San Marino** citizens

## Features :trophy:

- Fully **compliant to italian law** (Offical SDK used)
- Performs a **complete** validation (signature and business rules)
- Automatically **downloads** the list of valid keys and rules
- Supports the **official** Raspberry Pi camera
- Has a **modular** architecture (client/server)
- Can run on **any** recent Raspberry Pi boards
- Can **display** the video captured by the camera
- A browser-based client is also included
- A **browser-based** client is also included

![](https://github.com/lucadentella/raspberry-dgc/raw/main/images/architecture.png)

Expand Down
36 changes: 8 additions & 28 deletions documentation/businessrules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,20 @@

The validatorServer included in this project applies **italian** business rules.

Depending on the content of the green code, 3 checks are performed (in [app.js](https://github.com/lucadentella/raspberry-dgc/tree/main/validatorServer/app.js)):
To make this project compliant with italian law, the [Official SDK](https://github.com/italia/verificac19-sdk) is now used.

// 1. vaccination
if(dcc.payload.v) validate = vaccination.validateVaccination(settings, dcc);

// 2. test
if(dcc.payload.t) validate = test.validateTest(settings, dcc);

// 3. recovery
if(dcc.payload.r) validate = recovery.validateRecovery(settings, dcc);

The *validate* functions are defined in specific js files, included in the main program:

const vaccination = require("./vaccination.js")
const test = require("./test.js")
const recovery = require("./recovery.js")

The parameters used to apply the business rules are downloaded from the italian Ministry of Health website in JSON format:

const urlSettings = "https://get.dgc.gov.it/v1/dgc/settings";

The name of each parameter is defined as constant:
Validation is performed by SDK, using the `Validator` object:

const VACCINE_START_DAY_NOT_COMPLETE = "vaccine_start_day_not_complete";
const VACCINE_END_DAY_NOT_COMPLETE = "vaccine_end_day_not_complete";
let validationResult;
if(scanMode == "2G") validationResult = await Validator.validate(dcc, Validator.mode.SUPER_DGP);
else validationResult = await Validator.validate(dcc);

Depending on the format used by the single European country, it may therefore be necessary to:

- change the URL
- change the name of the parameters
If you want to change the server behavior, you have to replace the code with your country's specific rules.

## Rules API :information_source:

Some countries publish the **rules**, not the parameters.

The dcc-utils library does support the rule format defined by the EU, check [the example](https://github.com/ministero-salute/dcc-utils/blob/master/examples/check_rules_from_api.js) provided.
The Italian SDK is based on [dcc-utils] library, that is a more generic library to decode and validate DGCs.

The dcc-utils library does support the rule format defined by the EU, check [the example](https://github.com/ministero-salute/dcc-utils/blob/master/examples/check_rules_from_api.js) provided.
26 changes: 26 additions & 0 deletions documentation/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ When true, validatorServer returns holder details in the response:

![](https://github.com/lucadentella/raspberry-dgc/raw/main/images/holder-details.png)

**How can I get the detailed information about the result?**

In `app.js` set this constant to **true**:

const ADD_DETAILED_MESSAGE = true;

When true, validatorServer returns detailed information about the scan result:

![](https://github.com/lucadentella/raspberry-dgc/raw/main/images/scan-details.png)

**How can I ask for "Super DGC" scan?**

"Super DGC" means a green pass issued for vaccine or recovery only (not after a Covid test).

In the query string, add `scanMode=2G`:

![](https://github.com/lucadentella/raspberry-dgc/raw/main/images/scan-mode.png)

**How can I change the update frequency?**

In `app.js` change the default schedule - every 1 hour (in a cron-like form):

cron.schedule('0 * * * *', async () => {

You can use [Crontab Generator](https://crontab-generator.org/) to obtain the correct syntax.

**How can I use test DGCs?**

This Github repository ([dgc-testdata](https://github.com/eu-digital-green-certificates/dgc-testdata)) collects test data of different member states.
Expand Down
Binary file added images/scan-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/scan-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
207 changes: 207 additions & 0 deletions validatorServer/.cache/rules.json

Large diffs are not rendered by default.

268 changes: 268 additions & 0 deletions validatorServer/.cache/signatures.json

Large diffs are not rendered by default.

269 changes: 269 additions & 0 deletions validatorServer/.cache/signatureslist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
[
"25QCxBrBJvA=",
"NAyCKly+hCg=",
"ODqaG8mnbro=",
"e4lH6I4iMIM=",
"vvYa1vaWkGg=",
"NJpCsMLQco4=",
"/IcqIBnnZzc=",
"3IsdmTYkAAM=",
"4Qmniw7B0gc=",
"6ag2wJkSHtk=",
"ARrNkCRtprY=",
"BEnvMVnNFK8=",
"FDNJjaSCWi0=",
"GMFMBu1RlCg=",
"GuQPQRxbMsU=",
"IaGR283U1jA=",
"JHd4CkNzadI=",
"Jjql9rBrjHI=",
"L7XIA2gi2ps=",
"MtI93IMknMk=",
"NCc6YSsVioM=",
"YRYidQ+wetg=",
"YU9+X9nepqU=",
"ZcfkloEvfGQ=",
"dhSzPDr4G2M=",
"e9SH8dtWwdY=",
"hgpHHrTb4ws=",
"nPKEYm3gXzU=",
"qFNF2dC+mjQ=",
"tCM87WnaaQE=",
"ub6Qmv9xtAo=",
"x3ch4ml934I=",
"02vdAOY/+gI=",
"0kAwFy+vLpg=",
"1+da8dKEjlE=",
"2BGoyFIyYPs=",
"3LCRmucB9kU=",
"3jqajzfHpKE=",
"3lrBUHc4iQE=",
"5xtSr6KkAGA=",
"6FNkACSMLEc=",
"7XLhQx1KXdQ=",
"8AnF/hcilSo=",
"AQCGDydsS1Q=",
"CvktK3hdjeY=",
"DusseXrzqO8=",
"EzYR1uk/E0I=",
"IZftFLRmKGY=",
"Is2JtrOJhik=",
"MxhfdcoHinc=",
"NCdyt3s+cak=",
"OKpEjMo/2MY=",
"R7q7yd90ZPU=",
"TpQIkAHAym4=",
"Uj77p+qIQN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/Q=",
"MelIsUdzjbY="
]
Loading

0 comments on commit b2ccacc

Please sign in to comment.