A simple library to Decode, Generate and Validate EU-DCC / Vaccine Passports
Explore the docs »
Report Bug
·
Request Feature
This package offers simple API calls to Decode, Encode and Verify Vaccine Passes.
This package was a project to help me learn better about the protocols used.
Here's why:
- To understand how Vaccine Passports / EU-DCC / EU-DGC / Greenpasses work.
- Analyze what personal information is stored within.
- Understand the security and limitations.
Go get the module to import it into your project
- Download package
go get -u github.com/reznik99/go-dcc
Below is some examples of how you can use this package, without explicit error handling for simplicity's sake
- To generate an example EU-DCC vaccine certificate as QR code using data from
data.json
import ( "github.com/reznik99/go-dcc" ) func main() { var err = dcc.GenerateQR("./data.json", "DCC-Test.png") }
- To generate an example EU-DCC vaccine certificate as raw
import ( "fmt" "github.com/reznik99/go-dcc" ) func main() { data, err := dcc.Generate("./data.json") fmt.Printf("%s", data) // Will print `HC1:......` }
- To decode/read an EU-DCC QR code Vaccine Pass
import ( "fmt" "github.com/reznik99/go-dcc" "github.com/ethereum/go-ethereum/common/hexutil" ) func main() { payload, rawMsg, _ := dcc.ParseQR("path/to/qr-code.png") prettyDCC, _ := json.MarshalIndent(payload, "", " ") fmt.Printf("Headers: %v\n", rawMsg.Headers) fmt.Printf("Payload: %s\n", prettyDCC) fmt.Printf("Signature: %s\n", hexutil.Encode(rawMsg.Signature)) }
Example JSON data file
{
"name": "JOHN",
"surname": "DOE",
"dob": "1996-06-06",
"issuerCountry": "NZ",
"issuer": "Ministry of Health, NZ",
"vaccinationDate": "2021-10-21",
"doses": 2
}
For more examples, please refer to the Documentation
- Decode/Read EU DCC certs
- Encode/Generate EU DCC certs (Valid schema but not valid signature obviously)
- Verify/Validate EU DCC certs (This is not working quite yet)
See the open issues for a full list of proposed features (and known issues).
Distributed under the MIT License. See LICENSE
for more information.
Francesco Gorini - [email protected] - https://francescogorini.com
Project Link: https://github.com/reznik99/go-dcc/