issuer

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeyID

func NewKeyID(pub *ecdsa.PublicKey) []byte

func ReadHexFile

func ReadHexFile(target string) ([]byte, error)

func WriteHexFile

func WriteHexFile(key []byte, target string) error

Types

type Config

type Config struct {
	CredentialTypeConfig string `mapstructure:"credentialType"`
	UserID               string `mapstructure:"userID"`
	Password             string `mapstructure:"password"`
	OTPSecret            string `mapstructure:"otpSecret"`
	Debug                bool   `mapstructure:"debug"`
	DebugNoKeySubmit     bool   `mapstructure:"debugnokeysubmit"`
	// SaveFilePath sets the path of the file that should be used for the state-save file
	SaveFilePath string `mapstructure:"saveFilePath"`
	// WriteDebugFiles sets to write debug files of the certs and keys.
	WriteDebugFiles bool `mapstructure:"writeDebugFiles"`
	// DebugFilePrefix is the prefix used to name the debug files.
	DebugFilePrefix string `mapstructure:"debugFilePrefix"`
	// DebugFilePath is the path used to store the debug files.
	DebugFilePath string `mapstructure:"debugFilePath"`
	// CAURL is the url where the certificate authority can be found. This is also called the key management server.
	CAURL string `mapstructure:"caURL"`
	// OrgName is the organisation name of the organisation to use for certificate generation
	OrgName           string `mapstructure:"orgName"`
	EncryptionKeyName string `mapstructure:"encryptionKeyName"`
	// KeyRotationTime configures the approximate time during the day that new keys should be submitted in HH:mm
	KeyRotationTime string `mapstructure:"keyRotationTime"`
	// KeyUpdatePollPeriod configures how often in minutes this service should check
	// to see if new keys should be used or created.
	KeyUpdatePollPeriod int64 `mapstructcure:"keyUpdatePollPeriod"`
}

type Issuer

type Issuer struct {
	CredentialType credential.Type `cbor:"-"`
	LastUpdated    time.Time

	Keys []*KeySet

	Config `cbor:"-"`

	KeyRotationPeriod time.Duration
	Logger            *zap.Logger `cbor:"-"`
	// contains filtered or unexported fields
}

func New

func New(logger *zap.Logger, config Config) *Issuer

func (*Issuer) GetCurrentKey

func (is *Issuer) GetCurrentKey() *KeySet

func (*Issuer) HandleCreateCredential

func (is *Issuer) HandleCreateCredential(ctx *gin.Context)

func (*Issuer) HandleGet

func (is *Issuer) HandleGet(ctx *gin.Context)

func (*Issuer) Issue

func (is *Issuer) Issue(
	firstName string,
	lastName string,
	dob time.Time,
	procedures []credential.Procedure,
	result bool,
	orgName string,
) []byte

Issue generates a new BärCODE as a bitmap and returns it DoB will contain only date information with everything else being 0'd (including TZ, so that it uses UTC) This could potentially take a credential object containing the same fields.

func (*Issuer) MarshalSubmitKeysRequest

func (is *Issuer) MarshalSubmitKeysRequest(set *KeySet) ([]byte, error)

func (*Issuer) Save

func (is *Issuer) Save() error

func (*Issuer) ServiceLiveness added in v0.4.0

func (is *Issuer) ServiceLiveness(ctx *gin.Context)

ServiceLiveness checks the status of the service and returns a 200 if the service is in a good state, and a 500 if not.

func (*Issuer) SubmitNewKeys

func (is *Issuer) SubmitNewKeys(set *KeySet) error

type KeySet

type KeySet struct {
	Id        []byte //nolint:golint,revive,stylecheck
	CredType  credential.Type
	AESKey    []byte
	ECCKey    *privateKey
	ValidFrom time.Time
	ValidTo   time.Time
}

func NewKeySet

func NewKeySet(credType credential.Type) (*KeySet, error)

type ProcedureType

type ProcedureType int

type SubmitKeysRequest

type SubmitKeysRequest struct {
	CredType credential.Type
	AesKey   cbor.RawMessage
	ECCKey   cbor.RawMessage
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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