model

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package model is a model abstraction of health authorities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthAuthority

type HealthAuthority struct {
	ID       int64
	Issuer   string
	Audience string
	Name     string
	Keys     []*HealthAuthorityKey
}

HealthAuthority represents a public health authority that is authorized to issue diagnosis verification certificates accepted by this server.

func (*HealthAuthority) Validate

func (ha *HealthAuthority) Validate() error

Validate returns an error if the HealthAuthority struct is not valid.

type HealthAuthorityKey

type HealthAuthorityKey struct {
	AuthorityID  int64
	Version      string
	From         time.Time
	Thru         time.Time
	PublicKeyPEM string
}

HealthAuthorityKey represents a public key version for a given health authority.

func (*HealthAuthorityKey) FormattedFromTime

func (k *HealthAuthorityKey) FormattedFromTime() string

func (*HealthAuthorityKey) FormattedThruTime

func (k *HealthAuthorityKey) FormattedThruTime() string

func (*HealthAuthorityKey) FromHTMLDate

func (k *HealthAuthorityKey) FromHTMLDate() string

func (*HealthAuthorityKey) FromHTMLTime

func (k *HealthAuthorityKey) FromHTMLTime() string

func (*HealthAuthorityKey) IsFuture

func (k *HealthAuthorityKey) IsFuture() bool

func (*HealthAuthorityKey) IsValid

func (k *HealthAuthorityKey) IsValid() bool

IsValid returns true if the key is valid based on the current time.

func (*HealthAuthorityKey) IsValidAt

func (k *HealthAuthorityKey) IsValidAt(t time.Time) bool

IsValidAt returns true if the key is valid at a specific point in time.

func (*HealthAuthorityKey) PublicKey

func (k *HealthAuthorityKey) PublicKey() (*ecdsa.PublicKey, error)

PublicKey decodes the PublicKeyPEM text and returns the `*ecdsa.PublicKey` This system only supports verifying ECDSA JWTs, `alg: ES256`.

func (*HealthAuthorityKey) ThruHTMLDate

func (k *HealthAuthorityKey) ThruHTMLDate() string

func (*HealthAuthorityKey) ThruHTMLTime

func (k *HealthAuthorityKey) ThruHTMLTime() string

func (*HealthAuthorityKey) Validate

func (k *HealthAuthorityKey) Validate() error

Validate returns an error if the HealthAuthorityKey is not valid.

Jump to

Keyboard shortcuts

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