covpass

package
v0.0.0-...-269c371 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: GPL-2.0, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

/ https://github.com/stapelberg/coronaqr/blob/a597152e18513507a7e4bbfc28234b4fa458a047/coronaqr.go

Index

Constants

View Source
const (
	PCRTest        string = "LP6464-4"
	AntigenTest    string = "LP217198-3"
	PositiveResult string = "260373001"
	NegativeResult string = "260415000"
)
View Source
const (
	PCRTestExpiryTime     time.Duration = 72 * time.Hour
	AntigenTestExpiryTime time.Duration = 48 * time.Hour
)

Variables

This section is empty.

Functions

func ParseDay

func ParseDay(date string) (time.Time, error)

func Today

func Today() time.Time

Types

type CertType

type CertType int
const (
	PositivePCRTestCertType     CertType = 5
	NegativePCRTestCertType     CertType = 6
	PositiveAntigenTestCertType CertType = 7
	NegativeAntigenTestCertType CertType = 8
)
const (
	VaccinationFullProtectionCertType CertType = 0
	VaccinationCompleteCertType       CertType = 1
	VaccinationIncompleteCertType     CertType = 2
)
const RecoveryCertType CertType = 4

type CovCert

type CovCert struct {
	Issuer       string        `cbor:"-"`
	ValidFrom    time.Time     `cbor:"-"`
	ValidUntil   time.Time     `cbor:"-"`
	Version      string        `cbor:"ver"`
	Name         Name          `cbor:"nam"`
	DateOfBirth  string        `cbor:"dob"`
	Vaccinations []Vaccination `cbor:"v"`
	Recoveries   []Recovery    `cbor:"r"`
	Tests        []Test        `cbor:"t"`
}

func DecodeBytes

func DecodeBytes(val []byte) (*CovCert, error)

func DecodeString

func DecodeString(val string) (*CovCert, error)

func (*CovCert) BirthDateFormatted

func (c *CovCert) BirthDateFormatted() string

func (*CovCert) FullName

func (c *CovCert) FullName() string

func (*CovCert) FullNameReverse

func (c *CovCert) FullNameReverse() string

func (*CovCert) Recovery

func (c *CovCert) Recovery() *Recovery

func (*CovCert) Test

func (c *CovCert) Test() *Test

func (*CovCert) Vaccination

func (c *CovCert) Vaccination() *Vaccination

type Name

type Name struct {
	FamilyName    string `cbor:"fn"`
	FamilyNameStd string `cbor:"fnt"`
	GivenName     string `cbor:"gn"`
	GivenNameStd  string `cbor:"gnt"`
}

type Recovery

type Recovery struct {
	TargetDisease     string `cbor:"tg"`
	FirstResult       string `cbor:"fr"`
	ValidFrom         string `cbor:"df"`
	ValidUntil        string `cbor:"du"`
	Country           string `cbor:"co"`
	CertificateIssuer string `cbor:"is"`
	ID                string `cbor:"ci"`
}

func (*Recovery) Type

func (r *Recovery) Type() CertType

type Test

type Test struct {
	TargetDisease     string    `cbor:"tg"`
	TestType          string    `cbor:"tt"`
	TestName          string    `cbor:"nm"`
	Manufacturer      string    `cbor:"ma"`
	SampleCollection  time.Time `cbor:"sc"`
	TestResult        string    `cbor:"tr"`
	TestCentre        string    `cbor:"tc"`
	Country           string    `cbor:"co"`
	CertificateIssuer string    `cbor:"is"`
	ID                string    `cbor:"ci"`
}

func (*Test) IsPositive

func (t *Test) IsPositive() bool

func (*Test) Type

func (t *Test) Type() CertType

type Vaccination

type Vaccination struct {
	TargetDisease     string `cbor:"tg"`
	VaccineCode       string `cbor:"vp"`
	Product           string `cbor:"mp"`
	Manufacturer      string `cbor:"ma"`
	Occurence         string `cbor:"dt"`
	Country           string `cbor:"co"`
	CertificateIssuer string `cbor:"is"`
	ID                string `json:"ci"`
	TotalSerialDoses  int    `cbor:"sd"`
	DoseNumber        int    `cbor:"dn"`
}

func (*Vaccination) DaysSinceOccurence

func (v *Vaccination) DaysSinceOccurence() int

func (*Vaccination) HasFullProtection

func (v *Vaccination) HasFullProtection() bool

func (*Vaccination) IsComplete

func (v *Vaccination) IsComplete() bool

func (*Vaccination) IsCompleteSingleDose

func (v *Vaccination) IsCompleteSingleDose() bool

func (*Vaccination) Type

func (v *Vaccination) Type() CertType

Jump to

Keyboard shortcuts

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