Python NZ COVID Pass Verifier/Generator

Overview

Python NZ COVID Pass Verifier/Generator

This is quick proof of concept verifier I coded up in a few hours using various libraries to parse and generate QR codes in the NZ COVID Pass format.

Important note: I don't know anything about CWT or CBOR and I'm using libraries that perform cryptographic functions that I haven't vetted. Do not use this code for anything other than learning and experimentation.

Installing

$ sudo apt-get install python3-zbar
$ pip3 install -r requirements.txt

Docker

docker build -t nzcovidpass .
docker run -v $(pwd):/app/qr --rm nzcovidpass --qrcode-file /app/qr/Image.jpg

Usage

Verify NZ COVID Pass

usage: nz_covid_pass_verifier.py [-h] --qrcode-file QRCODE_FILE [--did-file DID_FILE]

NZ COVID Pass Verifier.

required arguments:
  --qrcode-file QRCODE_FILE
                        file name containing NZ COVID pass QR code

optional arguments:
  -h, --help            show this help message and exit
  --did-file DID_FILE   file name containing DID with verification keys

Supply a QR code filename and optional DID document containing verification keys, if you omit a DID document the official Ministry of Health verification keys will be used.

You can try with the sample QR codes provided:

$ python3 nz_covid_pass_verifier.py --qrcode-file examples/moh/valid/nzcp.png --did-file examples/moh/valid/did.json

iss: did:web:nzcp.covid19.health.nz
nbf: 2021-11-02 20:05:30+00:00
exp: 2031-11-02 20:05:30+00:00
vc:
  '@context':
  - https://www.w3.org/2018/credentials/v1
  - https://nzcp.covid19.health.nz/contexts/v1
  credentialSubject:
    dob: '1960-04-16'
    familyName: Sparrow
    givenName: Jack
  type:
  - VerifiableCredential
  - PublicCovidPass
  version: 1.0.0
jti: urn:uuid:60a4f54d-4e30-4332-be33-ad78b1eafa4b

Generate NZ COVID Pass

usage: nz_covid_pass_generator.py [-h] --signing-key-file SIGNING_KEY_FILE --qrcode-file QRCODE_FILE --dob DOB --given-name GIVEN_NAME --family-name FAMILY_NAME [--validity VALIDITY]

NZ COVID Pass Generator.

required arguments:
  --signing-key-file SIGNING_KEY_FILE
                        filename containing private signing key in JWK format
  --qrcode-file QRCODE_FILE
                        filename where QR code should be saved
  --dob DOB             date of birth for COVID Pass
  --given-name GIVEN_NAME
                        given name for COVID Pass
  --family-name FAMILY_NAME
                        family name for COVID Pass

optional arguments:
  -h, --help            show this help message and exit
  --validity VALIDITY   validity of NZ COVID Pass in days, default: 365

Example:

python3 nz_covid_pass_generator.py \
    --dob "1986-07-14" --given-name "SpongeBob" --family-name "SquarePants" \
    --signing-key-file examples/mine/private_signing_key.json \
    --qrcode-file examples/mine/spongebob-squarepants.png
You might also like...
Check COVID locations of interest against Google location history
Check COVID locations of interest against Google location history

Location of Interest Checker Script to compare COVID locations of interest to Google location history. The script produces a map plot (as shown below)

COVID-19 case tracker in Dash

covid_dashy_personal This is a personal project to build a simple COVID-19 tracker for Australia with Dash. Key functions of this dashy will be to Dis

We are building an open database of COVID-19 cases with chest X-ray or CT images.
We are building an open database of COVID-19 cases with chest X-ray or CT images.

🛑 Note: please do not claim diagnostic performance of a model without a clinical study! This is not a kaggle competition dataset. Please read this pa

Howell County, Missouri, COVID-19 data and (unofficial) estimates

COVID-19 in Howell County, Missouri This repository contains the daily data files used to generate my COVID-19 dashboard for Howell County, Missouri,

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak.
🦠 A simple and fast ( 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak.

🦠 A simple and fast ( 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!

Alerts for Western Australian Covid-19 exposure locations via email and Slack

WA Covid Mailer Sends alerts from Healthy WA's Covid19 Exposure Locations via email and slack. Setup Edit the configuration items in wacovidmailer.py

Covid-19-Trends - A project that me and my friends created as the CSC110 Final Project at UofT

Covid-19-Trends Introduction The COVID-19 pandemic has caused severe financial s

Ontario-Covid19-Screening - An automated Covid-19 School Screening Tool for Ontario

Ontario-Covid19-Screening An automated Covid-19 School Screening Tool for Ontari

A module comment generator for python

Module Comment Generator The comment style is as a tribute to the comment from the RA . The comment generator can parse the ast tree from the python s

Comments
  • How to use

    How to use

    done all that i can to figure out how to use the python generators and verifier properly, but nothing. I change the variables in the code and click on it, opens quickly then closes without adding/changing the output files. any instructions that make a bit more sense?

    opened by 2Keanan2 3
  • Add Docker support and fix Base32 Padding

    Add Docker support and fix Base32 Padding

    Small PR as your code is far cleaner than mine. 👍

    Having a docker for ease of deployment as depending on the environment base packages need to be added.

    Also added in support for Base32 padding, as the examples don't need it, but real entries I have tested with do.

    opened by plambrechtsen 0
Owner
NZ COVID Pass Community
NZ COVID Pass resources provided by the community
NZ COVID Pass Community
Ontario-Covid-Screening - An automated Covid-19 School Screening Tool for Ontario

Ontario-Covid19-Screening An automated Covid-19 School Screening Tool for Ontari

Rayan K 0 Feb 20, 2022
Run python scripts and pass data between multiple python and node processes using this npm module

Run python scripts and pass data between multiple python and node processes using this npm module. process-communication has a event based architecture for interacting with python data and errors inside nodejs.

Tyler Laceby 2 Aug 6, 2021
A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output.

quera_testcase_checker A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output. proper way to u

k3y1 1 Nov 15, 2021
Safely pass trusted data to untrusted environments and back.

ItsDangerous ... so better sign this Various helpers to pass data to untrusted environments and to get it back safe and sound. Data is cryptographical

The Pallets Projects 2.6k Jan 1, 2023
With the initiation of the COVID vaccination drive across India for all individuals above the age of 18, I wrote a python script which alerts the user regarding open slots in the vicinity!

cowin_notifier With the initiation of the COVID vaccination drive across India for all individuals above the age of 18, I wrote a python script which

null 13 Aug 1, 2021
Simple and easy to use python API for the COVID registration booking system of the math department @ unipd (torre archimede)

Simple and easy to use python API for the COVID registration booking system of the math department @ unipd (torre archimede). This API creates an interface with the official browser, with more useful functionalities.

Guglielmo Camporese 4 Dec 24, 2021
Vaksina - Vaksina COVID QR Validation Checker With Python

Vaksina COVID QR Validation Checker Vaksina is a general purpose library intende

Michael Casadevall 33 Aug 20, 2022
🌍💉 Global COVID-19 vaccination data at the regional level.

COVID-19 vaccination data at subnational level. To ensure its officiality, the source data is carefully verified.

sociepy 61 Sep 21, 2022
To check my COVID-19 vaccine appointment, I wrote an infinite loop that sends me a Whatsapp message hourly using Twilio and Selenium. It works on my Raspberry Pi computer.

COVID-19_vaccine_appointment To check my COVID-19 vaccine appointment, I wrote an infinite loop that sends me a Whatsapp message hourly using Twilio a

Ayyuce Demirbas 24 Dec 17, 2022
Repositorio com arquivos processados da CPI da COVID para facilitar analise

cpi4all Repositorio com arquivos processados da CPI da COVID para facilitar analise Organização No site do senado é possivel encontrar a lista de todo

Breno Rodrigues Guimarães 12 Aug 16, 2021