This repository contains a library and a command line utility in Go for parsing QR codes containing EU Digital COVID certificates.
Run the greenpass
utility under cmd/greenpass. It currently
supports PNG and JPEG.
Usage:
$ ./greenpass
Usage: ./greenpass <file name>
Example:
Download an example QR code, like https://github.com/ehn-dcc-development/dcc-testdata/blob/main/IE/png/1_qr.png .
Then run
$ go run . 1_qr.png
Name : Jane Bloggs
Date of Birth : 1988-06-07
Status : partially vaccinated (1 of 2 doses)
Vaccination date : 2021-05-06
You can use Read
or Decode
.
Read(r io.Reader)
receives a reader, like a file handle, and returns the COVID certificate object. It callsDecode
under the hood.Decode
receives animage.Image
and returns the COVID certificate object.
Examples:
Read
:
fd, _ := os.Open("myqrcode.png")
gp, _ := greenpass.Read(fd)
fmt.Printf("%+v", gp)
Decode
:
img, _, _ := image.Decode(reader)
gp, _ := greenpass.Decode(img)
fmt.Printf("%+v", gp)
Some data structures are generated via
tools/generate_types
. If you need to regenerate them
(e.g. because they were updated), just run go generate
in the top level
directory.