baercode

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version signifies the version of the BaerCode. Using an uint16 to give as more than
	// enough space to play with.
	Version         uint16 = 1
	VersionByteSize int    = 2

	DefaultQRScale int = 300
)

Variables

This section is empty.

Functions

func AddSignaturesAndGenerateQRBaerCode added in v0.2.6

func AddSignaturesAndGenerateQRBaerCode(
	signMessage *cose.SignMessage,
	signatures [][]byte,
) (qrcode []byte, err error)

AddSignaturesAndGenerateQRBaerCode takes a SignMessage and its digests, inserts the signatures, And returns the raw baercode in bytes.

func AddSignaturesAndGenerateRawBaerCode added in v0.2.6

func AddSignaturesAndGenerateRawBaerCode(
	signMessage *cose.SignMessage,
	signatures [][]byte,
) (baerCode []byte, err error)

AddSignaturesAndGenerateRawBaerCode takes a SignMessage and its digests, inserts the signatures, And returns the raw baercode in bytes.

func CreateBaerCode

func CreateBaerCode(
	firstName string,
	lastName string,
	dob time.Time,
	procedures []credential.Procedure,
	operator string,
	result bool,
	kid []byte,
	ecdsaPrivateKey *ecdsa.PrivateKey,
	aesKey []byte,
) (qrcode []byte, err error)

CreateBaerCode creates the credential, cbors it, encrypts it, signs it and returns the byte array.

func CreateBaerCodeQR

func CreateBaerCodeQR(
	firstName string,
	lastName string,
	dob time.Time,
	procedures []credential.Procedure,
	operator string,
	result bool,
	kid []byte,
	ecdsaPrivateKey *ecdsa.PrivateKey,
	aesKey []byte,
) (qrcode []byte, err error)

CreateBaerCodeQR creates the credential, cbors it, gzips it, encrypts it, signs it, base64s it, encodes it in a QR code and returns the base64ed image.

func CreateUnsignedBaerCodeWithDigests added in v0.2.6

func CreateUnsignedBaerCodeWithDigests(
	firstName string,
	lastName string,
	dob time.Time,
	procedures []credential.Procedure,
	operator string,
	result bool,
	kid []byte,
	ecdsaPublicKey *ecdsa.PublicKey,
	aesKey []byte,
) (signMessage *cose.SignMessage, digests [][]byte, err error)

CreateUnsignedBaerCodeWithDigests creates the credential, puts in into an encrypt0 message, encrypts it, and puts it in a signed message envelope, and creates the signature digests. It doesn't sign it, nor does it add the version. The point of this function is to be able to sign the digest in a different location.

func VerifyBaerCode

func VerifyBaerCode(
	b64code string,
	publicKey *ecdsa.PublicKey,
	cryptKey []byte,
) (cred credential.Credential, version uint16, err error)

VerifyBaerCode verifies a baercode. Used mainly for testing right now, so forgive some small shortcuts, like expecting the b64 code instead of the qr code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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