Documentation ¶
Index ¶
- func AnalyseMap(mapI interface{}, indent string) []string
- func DebugCBORCommonPayload(payload []byte) []string
- func PettyIdentCommonPayload(dcp *datamodel.DGCCommonPayload) (string, error)
- func PrettyIdent(i interface{}) (string, error)
- func ReadData(path string) (data []byte, err error)
- type Decoder
- type Output
- type ValueSetMapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyseMap ¶
AnalyseMap kept finding that different issues use different types so created this routine to scan whole structure and print out key, key.(type), value and value.(type) to help diagnose. Not can always see content if use -verbose 1 as does not try to JSON unmarshall
func DebugCBORCommonPayload ¶
DebugCBORCommonPayload display type and values
func PettyIdentCommonPayload ¶
func PettyIdentCommonPayload(dcp *datamodel.DGCCommonPayload) (string, error)
PettyIdentCommonPayload pretty ident
func PrettyIdent ¶
PrettyIdent pretty ident some json
Types ¶
type Decoder ¶
type Decoder interface { //FromFileQRCode assumes file contains a DGC QR code, reads a decodes. If any errors returns what it has //managed to decode so far. Accepts either .png or .jpg //DOES not verify FromFileQRCode(filename string) (*Output, error) //FromQRCodePNGBytes decode starting with a QR code PNG represented as bytes //first makes a local PNG image and the decodes to get the HC1: representation //if an error returns what it has processed so far //DOES not verify FromQRCodePNGBytes(pngB []byte) (*Output, error) //IsDGCFromQRCodeContents returns true if the card is a digital green card, does no processing //looks for HCI code IsDGCFromQRCodeContents(qrCodeContents []byte) bool //FromQRCodeContents decode from the QR code contents, this starts with HC1 //Does not verify FromQRCodeContents(qrCodeContents []byte) (*Output, error) }
Decoder methods to decode a EU covid certificate
type Output ¶
type Output struct { //Decoded set to true if the decoding completed ok without any issues Decoded bool //DecodedQRCode the result of reading the QR code DecodedQRCode []byte //Base45Decoded the result of base45 decoding the decoded QR code Base45Decoded []byte //Inflated the result of inflating the base45 decoded qr code Inflated []byte //COSeCBORTag the message is encoded as a CBOR Tagged Message, this is the TAG from the message. //currently only handle COSE_Sign1 which is tag 18 see https://datatracker.ietf.org/doc/html/rfc8152#section-2 COSeCBORTag uint64 CBORUnmarshalledI interface{} CBORUnmarshalledPayload []byte //cbor encoded payload PayloadI interface{} ProtectedHeader map[int]interface{} // did not make a COSEHeader as wanted to see what else is inside UnProtectedHeader *datamodel.COSEHeader COSESignature []byte //CommonPayload the common payload within the credential CommonPayload *datamodel.DGCCommonPayload //DiagnoseLines the decoding is multi-step if run into issues then diagnostic info is added here DiagnoseLines []string //if trying to learn display here }
Output the results of decoding
type ValueSetMapper ¶
type ValueSetMapper struct {
// contains filtered or unexported fields
}
ValueSetMapper maps codes to metadata value sets
func NewValueSetMapper ¶
func NewValueSetMapper(vsDataPath string) (*ValueSetMapper, error)
NewValueSetMapper create and initialize all its internal data
func (*ValueSetMapper) DecodeMA ¶
func (vsm *ValueSetMapper) DecodeMA(code string) *datamodel.ValueSetValue
DecodeMA decode the Marketing authorisation holder or manufacturer, a coded value from the value set vaccine-mah-manf.json
func (*ValueSetMapper) DecodeMP ¶
func (vsm *ValueSetMapper) DecodeMP(code string) *datamodel.ValueSetValue
DecodeMP decode the vaccine product name using A coded value from the value set vaccine-medicinal-product.json
func (*ValueSetMapper) DecodeVP ¶
func (vsm *ValueSetMapper) DecodeVP(code string) *datamodel.ValueSetValue
DecodeVP decode the Type of the vaccine or prophylaxis used from the value set vaccine-prophylaxis.json