Implementation for validating the NZ COVID Pass.

NZCP validator

Validates NZCP passes according to https://nzcp.covid19.health.nz.

Example

See example_test.go and tests for more examples.

func ExampleDecode() {
  q := "NZCP:/1/2KCEVIQEIVVWK6JNGEASNICZAEP2KALYDZSGSZB2O5SWEOTOPJRXALTDN53GSZBRHEXGQZLBNR2GQLTOPICRUYMBTIFAIGTUKBAAUYTWMOSGQQDDN5XHIZLYOSBHQJTIOR2HA4Z2F4XXO53XFZ3TGLTPOJTS6MRQGE4C6Y3SMVSGK3TUNFQWY4ZPOYYXQKTIOR2HA4Z2F4XW46TDOAXGG33WNFSDCOJONBSWC3DUNAXG46RPMNXW45DFPB2HGL3WGFTXMZLSONUW63TFGEXDALRQMR2HS4DFQJ2FMZLSNFTGSYLCNRSUG4TFMRSW45DJMFWG6UDVMJWGSY2DN53GSZCQMFZXG4LDOJSWIZLOORUWC3CTOVRGUZLDOSRWSZ3JOZSW4TTBNVSWISTBMNVWUZTBNVUWY6KOMFWWKZ2TOBQXE4TPO5RWI33CNIYTSNRQFUYDILJRGYDVAYFE6VGU4MCDGK7DHLLYWHVPUS2YIDJOA6Y524TD3AZRM263WTY2BE4DPKIF27WKF3UDNNVSVWRDYIYVJ65IRJJJ6Z25M2DO4YZLBHWFQGVQR5ZLIWEQJOZTS3IQ7JTNCFDX"

  t, err := nzcpv.NewToken(q)
  if err != nil {
    fmt.Println(err)
    return
  }

  // pretty print
  s, _ := json.MarshalIndent(t, "", "  ")
  fmt.Println(string(s))

  // Output:
  // {
  //   "KeyID": "key-1",
  //   "Algorithm": -7,
  //   "Issuer": "did:web:nzcp.covid19.health.nz",
  //   "NotBefore": "2021-11-03T09:05:30+13:00",
  //   "Expires": "2031-11-03T09:05:30+13:00",
  //   "JTI": "urn:uuid:60a4f54d-4e30-4332-be33-ad78b1eafa4b",
  //   "Claims": {
  //     "Context": [
  //       "https://www.w3.org/2018/credentials/v1",
  //       "https://nzcp.covid19.health.nz/contexts/v1"
  //     ],
  //     "Version": "1.0.0",
  //     "Type": [
  //       "VerifiableCredential",
  //       "PublicCovidPass"
  //     ],
  //     "CredentialSubject": {
  //       "GivenName": "Jack",
  //       "FamilyName": "Sparrow",
  //       "DOB": "1960-04-16"
  //     }
  //   },
  //   "Signature": "0uB7HdcmPYMxZr27TxoJODepBdfsou6Da2sq2iPCMVT7qIpSn2ddZobuYysJ7FgasI9ytFiQS7M5bRD6ZtEUdw=="
  // }
}

License

Copyright (c) 2021 Jonathan Chow

This project is licensed under the terms of the MIT license. See LICENSE for the full license text.

Owner
Jonathan Chow
Hobbyist programmer
Jonathan Chow
Similar Resources

Sliding window counters Redis rate limiting implementation for Golang

Sliding window counters Redis rate limiting implementation for Golang (Based on the Figma API rate limit algorithm)

Dec 21, 2022

Generic Free List implementation to reuse memory and avoid allocations

gofl GOFL provides a Generic Free List implementation for Go. Installation This

Oct 17, 2022

yaml-patch is a version of Evan Phoenix's json-patch, which is an implementation of JSON Patch, directly transposed to YAML

yaml-patch yaml-patch is a version of Evan Phoenix's json-patch, which is an implementation of JavaScript Object Notation (JSON) Patch, directly trans

Jan 15, 2022

A pure Golang implementation of Rockchip rknand vendor storage interface.

go-rkvendorstorage A pure Golang implementation of Rockchip rknand vendor storage interface. Usage package main import ( "fmt" "github.com/jamesits

Nov 8, 2022

Golang 1.18+ Generics implementation of Set methods

Golang Generics: Set A golang 1.18+ implementation of Set using Go generics Installation $ go get -u github.com/chrispappas/golang-generics-set Quick

Oct 26, 2022

EU Digital Covid Certificate utilities in Go [Create, Validate and Parse Green-Pass/EU-DCC]

go-dcc EU Digital Covid Certificate utilities in Go [Create, Validate and Parse Green-Pass/EU-DCC] Repo work in-progress CLI Usage: ######Create and S

Dec 23, 2021

W5-test-go - Write functions to pass the tests with the cases need to pass

Week 5 Assignment In this assignment, we expect to you write functions to pass t

Feb 11, 2022

Golang implementation of the covid certificate QRCode decoder

Golang implementation of the covid certificates. At the moment it only includes DCC signed data decoding but I've planned to add a lot more of features related to certificates processing.

Sep 22, 2021

Go implementation Welford’s method for one-pass variance computation

Welford - Online method of calculating variance and standard deviation Go implementation Welford’s method for one-pass variance computation with D. H.

Jan 6, 2023

Go implementation Welford’s method for one-pass variance computation

Variance and standard deviation caluculation using variance's algorithm Table of Contents Introduction Installation Usage Contributing License Introdu

Jun 5, 2022

Exposure Notification Reference Server | Covid-19 Exposure Notifications

Exposure Notification Reference Key Server COVID‑19 Exposure Notifications API Exposure Notification Reference Key Server Documentation In our continu

Jan 7, 2023

Go decoder for EU Digital COVID Certificate (EUDCC) QR code data

Go Corona QR Code Decoder This repository contains a decoder for EU Digital COVID Certificate (EUDCC) QR code data, written in Go. If you got vaccinat

Nov 30, 2022

A simple Go lib to get information on Covid-19

Govid A simple Go library which lets you get information on Covid-19 Examples Getting total data about all countires: package main import ( "Govid/g

Aug 18, 2022

CircleHash is a family of fast hashes that pass SMHasher, are faster than XXH64, SipHash, etc. and are easy to audit

CircleHash CircleHash is a family of non-cryptographic hash functions that pass every test in SMHasher (both rurban/smhasher and demerphq/smhasher). T

Sep 18, 2022

A COVID-19 Certificate Decoder based on @stapelberg's coronaqr library / CLI

corona-decoder This is a super simple CLI application that uses @stapelberg's coronaqr library / CLI to provide quickly some information about a COVID

Mar 1, 2022

COVID-19 certificate parser/validator API

COVID-19 certificate parser/validator API

=covid-decoder= A simple REST API that parses COVID-19 certificates (provided in textual form) 🚀 Motivation There are plenty of Green Pass (COVID-19

Dec 7, 2021

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

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

go-smarthealthcards Golang libraries for generating QR codes for Smart Health Cards representing COVID-19 Immunizations. Usage Individual Libraries Yo

Dec 5, 2021

Simple Notifier/Listener utility package to pass around messages in-memory

Simple Observer (go) A small simple library to use for sending around messages in-memory. It uses a notifier/listener style messaging. Installation go

Dec 7, 2021

Icode-by-pass - Imooc的icode认证原理探究

Icode-by-pass - Imooc的icode认证原理探究

原理 docker镜像本质是一堆文件的集合,既然是文件,那就可以直接访问。 docker inspect 镜像名 可以看到镜像文件存放的位置 通过docke

Dec 13, 2022
Related tags
go implementation of timsort

timsort timsort is a Go implementation of Tim Peters's mergesort sorting algorithm. For many input types it is 2-3 times faster than Go's built-in sor

Nov 7, 2022
Implementation of do255e and do255s in Go

Go Implementation of do255e and do255s This is a plain Go implementation of do255e and do255s. It is considered secure; all relevant functions should

Aug 15, 2022
Go implementation of the Heaven's Gate technique
Go implementation of the Heaven's Gate technique

gopherheaven is a Go implementation of the classic Heaven's Gate technique originally published by roy g biv on VX Heaven in 2009. gopherheaven can be used as an evasion technique to directly call 64-bit code from a 32-bit process.

Dec 20, 2022
Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation

stack Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation Purpose Provide a fast, thread safe, and generic Golang Stack API with minim

May 3, 2022
Optimal implementation of ordered maps for Golang - ie maps that remember the order in which keys were inserted.

Goland Ordered Maps Same as regular maps, but also remembers the order in which keys were inserted, akin to Python's collections.OrderedDicts. It offe

Jan 3, 2023
An idiomatic Go implementation of Leaky bucket.

lbucket lbucket is an idiomatic Go leaky bucket implementation. The library make use of plain old Go stdlib; in other words, there are no third-party

Apr 17, 2022
A faster RWLock primitive in Go, 2-3 times faster than RWMutex. A Go implementation of concurrency control algorithm in paper

Go Left Right Concurrency A Go implementation of the left-right concurrency control algorithm in paper <Left-Right - A Concurrency Control Technique w

Jan 6, 2023
Go implementation of the geodesic routines from GeographicLib
Go implementation of the geodesic routines from GeographicLib

geodesic This package is a Go implementation of the geodesic routines from GeographicLib. Features Pure Go implementation Distance calculations with n

Dec 23, 2022
go-logr implementation with pterm
go-logr implementation with pterm

plogr go-logr implementation with pterm Usage See examples Add more colors and levels By default, only level 0 (info) and level 1 (debug) are supporte

Dec 22, 2021
Reference go implementation of globaldce protocol

globaldce-go This is the reference implementation of the command line interface of globaldce coded in the go programming language. This project is sti

Nov 8, 2021