Documentation ¶
Overview ¶
Package coronaqr provides a decoder for EU Digital COVID Certificate (EUDCC) QR code data.
See https://github.com/eu-digital-green-certificates for the specs, testdata, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDecoder = &Decoder{}
DefaultDecoder is a ready-to-use Decoder.
Functions ¶
This section is empty.
Types ¶
type CertificateProvider ¶
type CertificateProvider interface { // GetCertificate returns the public key of the certificate for the // specified country and key identifier, or an error if the certificate was // not found. // // Country is a ISO 3166 alpha-2 code, e.g. CH. // // kid are the first 8 bytes of the SHA256 digest of the certificate in DER // encoding. GetCertificate(country string, kid []byte) (*x509.Certificate, error) }
CertificateProvider is typically implemented using a JSON Web Key Set, or by pinning a specific government certificate.
type CovidCert ¶
type CovidCert struct { Version string `cbor:"ver" json:"version"` PersonalName Name `cbor:"nam" json:"name"` DateOfBirth string `cbor:"dob" json:"dateOfBirth"` VaccineRecords []VaccineRecord `cbor:"v" json:"vaccineRecords"` TestRecords []TestRecord `cbor:"t" json:"testRecords"` RecoveryRecords []RecoveryRecord `cbor:"r" json:"recoveryRecords"` }
type Decoded ¶
type Decoded struct { Cert CovidCert IssuedAt time.Time Expiration time.Time // SignedBy is the x509 certificate whose signature of the COVID Certificate // has been successfully verified, if Verify() was used and the trustlist // makes available certificates (as opposed to just public keys). SignedBy *x509.Certificate }
Decoded is a EU Digital COVID Certificate (EUDCC) that has been decoded and possibly verified.
type PublicKeyProvider ¶
type PublicKeyProvider interface { // GetPublicKey returns the public key of the certificate for the specified // key identifier (or country), or an error if the public key was not found. // // Country is a ISO 3166 alpha-2 code, e.g. CH. // // kid are the first 8 bytes of the SHA256 digest of the certificate in DER // encoding. GetPublicKey(country string, kid []byte) (crypto.PublicKey, error) }
PublicKeyProvider is typically implemented using a JSON Web Key Set, or by pinning a specific government certificate.
type RecoveryRecord ¶
type RecoveryRecord struct { Target string `cbor:"tg" json:"target"` // ISO 8601 complete date of first positive NAA test result FirstPositiveTestDate string `cbor:"fr" json:"firstPositiveTestDate"` ValidFromDate string `cbor:"df" json:"validFromDate"` // ISO 8601 complete date ValidUntilDate string `cbor:"du" json:"validUntilDate"` // ISO 8601 complete date // Country of Test Country string `cbor:"co" json:"country"` Issuer string `cbor:"is" json:"issuer"` CertificateID string `cbor:"ci" json:"certificateID"` }
type TestRecord ¶
type TestRecord struct { Target string `cbor:"tg" json:"target"` TestType string `cbor:"tt" json:"testType"` // Name is the NAA Test Name Name string `cbor:"nm" json:"name"` // Manufacturer is the RAT Test name and manufacturer. Manufacturer string `cbor:"ma" json:"manufacturer"` SampleDatetime string `cbor:"sc" json:"sampleDatetime"` TestResult string `cbor:"tr" json:"testResult"` TestingCentre string `cbor:"tc" json:"testingCentre"` // Country of Test Country string `cbor:"co" json:"country"` Issuer string `cbor:"is" json:"issuer"` CertificateID string `cbor:"ci" json:"certificateID"` }
type Unverified ¶
type Unverified struct {
// contains filtered or unexported fields
}
Unverified is a EU Digital COVID Certificate (EUDCC) that was decoded, but not yet verified.
func Decode ¶
func Decode(qrdata string) (*Unverified, error)
Decode decodes the specified EU Digital COVID Certificate (EUDCC) QR code data.
func (*Unverified) SkipVerification ¶
func (u *Unverified) SkipVerification() *Decoded
SkipVerification skips all cryptographic signature verification and returns the unverified certificate data.
func (*Unverified) Verify ¶
func (u *Unverified) Verify(certprov PublicKeyProvider) (*Decoded, error)
Verify checks the cryptographic signature and returns the verified EU Digital COVID Certificate (EUDCC) or an error if verification fails.
certprov can optionally implement the CertificateProvider interface.
type VaccineRecord ¶
type VaccineRecord struct { Target string `cbor:"tg" json:"target"` Vaccine string `cbor:"vp" json:"vaccine"` Product string `cbor:"mp" json:"product"` Manufacturer string `cbor:"ma" json:"manufacturer"` Doses float64 `cbor:"dn" json:"doses"` // int per the spec, but float64 e.g. in IE DoseSeries float64 `cbor:"sd" json:"doseSeries"` // int per the spec, but float64 e.g. in IE Date string `cbor:"dt" json:"date"` Country string `cbor:"co" json:"country"` Issuer string `cbor:"is" json:"issuer"` CertificateID string `cbor:"ci" json:"certificateID"` }
see https://github.com/ehn-dcc-development/ehn-dcc-schema/blob/release/1.3.0/DCC.Types.schema.json
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
trustlist
|
|
trustlistmirror
Package trustlistmirror queries https://github.com/section42/hcert-trustlist-mirror for trustlists of various EU member states.
|
Package trustlistmirror queries https://github.com/section42/hcert-trustlist-mirror for trustlists of various EU member states. |