Code Monkey home page Code Monkey logo

go-dcc's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

GO-DCC

A simple library to Decode, Generate and Validate EU-DCC / Vaccine Passports
Explore the docs »

Report Bug · Request Feature

About This Package

Product Name Screen Shot

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.

Getting Started

Prerequisites

Go get the module to import it into your project

  1. Download package
    go get -u github.com/reznik99/go-dcc

Usage

Below is some examples of how you can use this package, without explicit error handling for simplicity's sake

  1. 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")
    }
  2. 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:......`
    }
  3. 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

(back to top)

Roadmap

  • 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).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Francesco Gorini - [email protected] - https://francescogorini.com

Project Link: https://github.com/reznik99/go-dcc/

(back to top)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.