go-smarthealthcards

module
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2021 License: MIT

README

go-smarthealthcards

Golang libraries for generating QR codes for SMART Health Cards representing COVID-19 Immunizations.

Demo

demo

Documentation

godoc

Example

You can use the libraries in this module independently, or you can compose the libraries in this module together for a full end-to-end solution:

Generate a signing key and set environment variables
$ eval `go run utils/keygen.go`

$ env | grep SMART_HEALTH_CARDS
SMART_HEALTH_CARDS_KEY_Y=101429470610882177913719193785842901742785774962016470785491662750285266794880
SMART_HEALTH_CARDS_KEY_X=54331567703018507947599648321661141913001722275227305175319502486118882894610
SMART_HEALTH_CARDS_KEY_D=71127180180681625720019072005809291232785768180646325329981160435676730627285
Start an example web server
$ go run examples/server.go
Inspect the JSON Web Key Set representation of the signing key's public key
$ curl -s http://localhost:8080/.well-known/jwks.json | jq .
{
  "keys": [
    {
      "kty": "EC",
      "kid": "9G2pzRWd-FL4XwNpDuXUHnG5egt38E78hSqMQzL5v3E",
      "use": "sig",
      "alg": "ES256",
      "crv": "P-256",
      "x": "eB6T2wFY60skcvNQAQPS5l_yhCEnrwo5P6yoHIqQYxI",
      "y": "4D8LwoIvKk7di9p83_8oTMvr3VJootJKC6iL1cuJuYA"
    }
  ]
}
Generate a QR code
$ curl -s -X POST http://localhost:8080 \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "\
family_name=Salk\
&given_names=Jonas\
&date_of_birth=1914-10-28\
&first_immunization_performer=MyLocalHospital\
&first_immunization_lot_number=LN01234\
&first_immunization_vaccine_type=Pfizer\
&first_immunization_date=2021-06-01" \
  -o /tmp/qr.png

$ open /tmp/qr.png

Limitations

  • This module currently only supports certain COVID-19 immunizations; with minor modifications it could be generalized to support all COVID-19 immunizations, and even immunizations of other diseases
  • This module does not support other types of SMART Health Cards such as those for dianoses or lab results, only immunizations

License

MIT License

Directories

Path Synopsis
Package ecdsa loads an ECDSA P-256 private key (*crypto/ecdsa.PrivateKey) from string representations of its key parameters.
Package ecdsa loads an ECDSA P-256 private key (*crypto/ecdsa.PrivateKey) from string representations of its key parameters.
Package fhirbundle constructs and marshals a (pre-compressed) JWS payload containing an FHIR bundle of information representing COVID-19 immunizations.
Package fhirbundle constructs and marshals a (pre-compressed) JWS payload containing an FHIR bundle of information representing COVID-19 immunizations.
Package jws creates a compact serialization of a JSON Web Signature (JWS) with the ECDSA P-256 SHA-256 signing algorithm and DEFLATE compression of the payload and creates a serialization of a JSON Web Key Set representing the public key of an ECDSA P-256 key.
Package jws creates a compact serialization of a JSON Web Signature (JWS) with the ECDSA P-256 SHA-256 signing algorithm and DEFLATE compression of the payload and creates a serialization of a JSON Web Key Set representing the public key of an ECDSA P-256 key.
Package qrcode creates one or more QR codes in PNG format encoding the JWS of a SMART Health Card such that smart devices such as iPhones can scan the QR code(s) and load the SMART Health Card information in applications such as the Wallet and Health apps for the iPhone.
Package qrcode creates one or more QR codes in PNG format encoding the JWS of a SMART Health Card such that smart devices such as iPhones can scan the QR code(s) and load the SMART Health Card information in applications such as the Wallet and Health apps for the iPhone.
Package webhandlers can be used in a web-based application for issuing SMART Health Card QR codes for COVID-19 immunizations.
Package webhandlers can be used in a web-based application for issuing SMART Health Card QR codes for COVID-19 immunizations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL