Versions in this module Expand all Collapse all v0 v0.1.0 Nov 27, 2022 Changes in this version + const CBOR_Magic_ID + const COSE_Sign + const COSE_Sign1 + const CWT_ALG + const CWT_KID + const CWT_Tag + const EUDCC_EXPIRES_AT + const EUDCC_HCERT + const EUDCC_ISSUED_AT + const EUDCC_ISSUER + const EUDCC_V1 + const MT_ARRAY + const MT_BYTES + const MT_FLOAT + const MT_INTEGER + const MT_MAP + const MT_NEGINTEGER + const MT_TAG + const MT_UTF8 + const ValidationErrorAudience + const ValidationErrorClaimsInvalid + const ValidationErrorExpired + const ValidationErrorId + const ValidationErrorIssuedAt + const ValidationErrorIssuer + const ValidationErrorMalformed + const ValidationErrorNotValidYet + const ValidationErrorSignatureInvalid + const ValidationErrorUnverifiable + var ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") + var ErrHashUnavailable = errors.New("the requested hash function is unavailable") + var ErrInvalidKey = errors.New("key is invalid") + var ErrInvalidKeyType = errors.New("key is of invalid type") + var ErrTokenExpired = errors.New("token is expired") + var ErrTokenInvalidAudience = errors.New("token has invalid audience") + var ErrTokenInvalidClaims = errors.New("token has invalid claims") + var ErrTokenInvalidId = errors.New("token has invalid id") + var ErrTokenInvalidIssuer = errors.New("token has invalid issuer") + var ErrTokenMalformed = errors.New("token is malformed") + var ErrTokenNotValidYet = errors.New("token is not valid yet") + var ErrTokenSignatureInvalid = errors.New("token signature is invalid") + var ErrTokenUnverifiable = errors.New("token is unverifiable") + var ErrTokenUsedBeforeIssued = errors.New("token used before issued") + var ValidMethods = map[string]bool + func CBORType(c []byte) int + func FromQRCodeToRaw(qrCode []byte) ([]byte, error) + func GetAlgorithms() (algs []string) + func PayloadAsCWT(eu *EUDCCPayload) []byte + func RegisterSigner(alg string, s Signer) + type ArrayCBOR []byte + type CBORDecoder struct + func NewCBORDecoder(b []byte) *CBORDecoder + func (cb *CBORDecoder) DecodeBstr() ([]byte, error) + func (cb *CBORDecoder) DecodeItem() (any, error) + func (cb *CBORDecoder) DecodeMap() (map[any]any, error) + func (cb *CBORDecoder) ReadLength() (int64, error) + func (cb *CBORDecoder) ReadUint16() (int64, error) + func (cb *CBORDecoder) ReadUint32() (int64, error) + func (cb *CBORDecoder) ReadUint64() (int64, error) + func (cb *CBORDecoder) ReadUint8() (int64, error) + func (r *CBORDecoder) Len() int + func (r *CBORDecoder) PeekByte() (byte, error) + func (r *CBORDecoder) Read(b []byte) (n int, err error) + func (r *CBORDecoder) ReadAt(b []byte, off int64) (n int, err error) + func (r *CBORDecoder) ReadByte() (byte, error) + func (r *CBORDecoder) ReadRune() (ch rune, size int, err error) + func (r *CBORDecoder) ReadSlice(n int) (s []byte, err error) + func (r *CBORDecoder) Reset(b []byte) + func (r *CBORDecoder) Seek(offset int64, whence int) (int64, error) + func (r *CBORDecoder) Size() int64 + func (r *CBORDecoder) UnreadByte() error + func (r *CBORDecoder) UnreadRune() error + func (r *CBORDecoder) WriteTo(w io.Writer) (n int64, err error) + type CBOREncoder struct + func NewCBOREncoder() *CBOREncoder + func (ce *CBOREncoder) Bytes() []byte + func (ce *CBOREncoder) EncodeAny(item any) *CBOREncoder + func (ce *CBOREncoder) EncodeArray(sourceArray []any) *CBOREncoder + func (ce *CBOREncoder) EncodeBytes(sourceBstr []byte) *CBOREncoder + func (ce *CBOREncoder) EncodeInteger(val int64) *CBOREncoder + func (ce *CBOREncoder) EncodeMap(sourceMap map[any]any) *CBOREncoder + func (ce *CBOREncoder) EncodeString(sourceString string) *CBOREncoder + func (ce *CBOREncoder) Reset() *CBOREncoder + type CWT struct + CBORPayload MapCBOR + CBORProtectedHeaders MapCBOR + CBORSignature SignatureCBOR + CBORUnprotectedHeaders map[any]any + Method Signer + ProtectedHeaders *ProtectedHeaders + Raw []byte + Valid bool + func (cwt *CWT) Dump() string + func (cwt *CWT) Sign(key *crypto.PrivateKey) ([]byte, error) + func (cwt *CWT) SigningBytes() []byte + func (cwt *CWT) Verify(key *crypto.PublicKey) (bool, error) + type EUDCC struct + Payload *EUDCCPayload + ValidMethods map[string]bool + func DecodeEU_DCC_QR(qrCode []byte) (*EUDCC, error) + func EUDCCFromSerializedCWT(raw []byte) (*EUDCC, error) + func NewEUDCC(payload *EUDCCPayload, alg string) (*EUDCC, error) + func (eu *EUDCC) DecodeUntaggedCOSE() error + func (eu *EUDCC) Dump() string + func (eu *EUDCC) EncodeAndSign(privateKeyFunc PrivateKeyResolution) ([]byte, error) + func (eu *EUDCC) VerifyWith(publicKeyFunc PublicKeyResolution) (bool, error) + type EUDCCPayload struct + DateOfBirth string + ExpiresAt int64 + Forename string + ForenameTransliterated string + IssuedAt int64 + Issuer string + Surname string + SurnameTransliterated string + VaccinationCert *VaccinationCert + Version string + func PayloadAsJWT(p map[any]any) *EUDCCPayload + type EUDCCPayload_ struct + DateOfBirth string + ExpiresAt int64 + Forename string + ForenameTransliterated string + IssuedAt int64 + Issuer string + Surname string + SurnameTransliterated string + VaccinationCert *VaccinationCert + Version string + type MapCBOR []byte + type PrivateKeyResolution func(*EUDCC) (*jwt.JWK, error) + type ProtectedHeaders struct + Alg string + Kid string + Method Signer + func ProtectedHeadersFromCBOR(CBORProtectedHeaders MapCBOR) (ph *ProtectedHeaders) + func (ph *ProtectedHeaders) ToCBOR() MapCBOR + type PublicKeyResolution func(*EUDCC) (*jwt.JWK, error) + type SigStructure struct + type SignatureCBOR []byte + type Signer interface + Alg func() string + Available func() bool + Sign func(signingBytes []byte, privateKey *crypto.PrivateKey) ([]byte, error) + Verify func(signingBytes, signature []byte, publicKey *crypto.PublicKey) error + func GetSigner(alg string) (s Signer) + type SignerECDSA struct + CurveBits int + Hash crypto.Hash + Hasher hash.Hash + KeySize int + Name string + var SignerES256 *SignerECDSA + var SignerES384 *SignerECDSA + var SignerES512 *SignerECDSA + func (m *SignerECDSA) Alg() string + func (m *SignerECDSA) Available() bool + func (m *SignerECDSA) Sign(signingBytes []byte, key *crypto.PrivateKey) ([]byte, error) + func (m *SignerECDSA) Verify(signingBytes, signature []byte, key *crypto.PublicKey) error + type VaccinationCert struct + CertificateIdentifier string + CertificateIssuer string + CountryCode string + DateVaccination string + DiseaseAgentTargeted string + DoseNumber int64 + DoseTotal int64 + VaccineMahManf string + VaccineMedicinalProduct string + VaccineProphylaxis string + func FromIntermediateCBOR(vdata any) *VaccinationCert + func (vc *VaccinationCert) ToIntermediateCBOR() []any + type ValidationError struct + Errors uint32 + Inner error + func NewValidationError(errorText string, errorFlags uint32) *ValidationError + func (e *ValidationError) Is(err error) bool + func (e *ValidationError) Unwrap() error + func (e ValidationError) Error() string