credential

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Credential

type Credential struct {
	FirstName         string
	LastName          string
	DateOfBirth       time.Time
	DiseaseType       DiseaseType
	Procedures        []Procedure
	ProcedureOperator string
	ProcedureResult   bool
	// contains filtered or unexported fields
}

Credential represents the bare minimum data the verifier needs to both verify that the offered test is valid, and that the valid test belongs to the person offering it.

func FromCBOR

func FromCBOR(cborCredential []byte) (credential Credential, err error)

FromCBOR decodes a CBOR encoded credential and returns it.

func New

func New(
	firstName string,
	lastName string,
	dob time.Time,
	procedures []Procedure,
	operator string,
	result bool,
) (cred Credential)

New takes all information and returns a credential.

func (Credential) ToCBOR

func (c Credential) ToCBOR() (cborCredential []byte, err error)

ToCBOR marshals the credential to CBOR.

type DiseaseType

type DiseaseType int
const (
	// DiseaseTypeUnspecified - Unspecified disease.
	DiseaseTypeUnspecified DiseaseType = iota
	// DiseaseTypeCOVID19 - SARS-CoV-19.
	DiseaseTypeCOVID19
)

type Procedure

type Procedure struct {
	Type ProcedureType `json:"Type"`
	Time time.Time     `json:"Time"`
	// contains filtered or unexported fields
}

Procedure represents a procedure, which is a combination of procedure type and procedure time.

type ProcedureType

type ProcedureType int
const (
	// ProcedureTypeNA - Not Applicable, used for tests and single shot vaccines.
	ProcedureTypeNA ProcedureType = iota
	// ProcedureTypeTestAntigen - Antigen tests.
	ProcedureTypeTestAntigen
	// ProcedureTypePCR - PCR tests.
	ProcedureTypePCR
	// ProcedureTypeCormirnaty - BioNTech Manufacturing GmbH - mRNA vaccine - Dual shots required.
	ProcedureTypeCormirnaty
	// ProcedureTypeJanssen - Janssen-Cilag International NV - Vector vaccine - Single shot required.
	ProcedureTypeJanssen
	// ProcedureTypeModerna - Moderna Biotech Spain, S.L. - mRNA vaccine - Dual shots required.
	ProcedureTypeModerna
	// ProcedureTypeVaxzevria - AstraZeneca AB, Sweden - Vector vaccine - Dual shots required.
	ProcedureTypeVaxzevria
	// ProcedureTypeDiagnosis - A positive diagnosis - Any reliable diagnosis of a patient having gotten COVID19.
	// Treated vaccine-like based on requirements.
	ProcedureTypeDiagnosis
)

type Type

type Type int
const (
	CredTypeUnspecified Type = iota
	CredTypeVaccine
	CredTypeNegativeTest
	// CredTypeInvalid should remain the max value,
	// and is used for validating input values are within
	// the valid range of "0 up to but not including invalid".
	CredTypeInvalid
)

Jump to

Keyboard shortcuts

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