87 lines
2.0 KiB
Markdown
87 lines
2.0 KiB
Markdown
# Covid Passport Decoder
|
|
|
|
Forked from [ggqc007/Covid-QR-Decoder](https://github.com/ggqc007/Covid-QR-Decoder). Removed the JS version and improved the Py version.
|
|
|
|
* * *
|
|
|
|
A simple commandline tool to extract the data from a Covid-19 QR code in the SMART Health Card format. Displays the data with fancy formatting. No error checking is preformed.
|
|
|
|
Sample code is included to validate the QR code. Requires the public key from an authority (probably the government).
|
|
|
|
More info about the SMART Health Cards Framework can be found here:
|
|
<https://spec.smarthealth.cards/>
|
|
|
|
* * *
|
|
|
|
# Usage
|
|
|
|
1. `pip install python-jose pyzbar rich`
|
|
2. `./covid-qr-decode.py [path to QR code]`
|
|
|
|
**Raw QR Code Data**: You can specify `--raw` to enter the raw QR code data instead of the path to a QR file.
|
|
|
|
**Validate:** To validate the QR code signature, add `--validate [path to public key]`.
|
|
|
|
# Sample Data Output
|
|
|
|
```json
|
|
{"kid":"SOME-KEY-ID","zip":"SOME-ZIP","alg":"ES256"}
|
|
|
|
{
|
|
"resource": {
|
|
"resourceType": "Patient",
|
|
"name": [
|
|
{
|
|
"family": [
|
|
"NAME"
|
|
],
|
|
"given": [
|
|
"SURNAME"
|
|
]
|
|
}
|
|
],
|
|
"birthDate": "1900-01-01",
|
|
"gender": "SEX"
|
|
}
|
|
}
|
|
{
|
|
"resource": {
|
|
"resourceType": "Immunization",
|
|
"vaccineCode": {
|
|
"coding": [
|
|
{
|
|
"system": "http://hl7.org/fhir/sid/cvx",
|
|
"code": "208"
|
|
}
|
|
]
|
|
},
|
|
"patient": {
|
|
"reference": "resource:0"
|
|
},
|
|
"lotNumber": "SOME-LOT-NUMBER",
|
|
"status": "Completed",
|
|
"occurrenceDateTime": "2021-04-01T04:00:00+00:00",
|
|
"location": {
|
|
"reference": "resource:0",
|
|
"display": "VACCINATION-SITE"
|
|
},
|
|
"protocolApplied": {
|
|
"doseNumber": 1,
|
|
"targetDisease": {
|
|
"coding": [
|
|
{
|
|
"system": "http://browser.ihtsdotools.org/?perspective=full&conceptId1=840536004",
|
|
"code": "840536004"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"note": [
|
|
{
|
|
"text": "PB COVID-19"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|