db

package
v0.0.0-...-d1cd67c Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EntityStateUnknown  string = ""
	EntityStatePending  string = "PENDING"
	EntityStateApproved string = "APPROVED"
	EntityStateRejected string = "REJECTED"
	EntityStateRevoked  string = "REVOKED"
	EntityStateOneOff   string = "ONEOFF"
)

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

func DropIfExists

func DropIfExists(db *gorm.DB) error

func EntityStateToPB

func EntityStateToPB(name string) pb.Entity_State

func PBToEntityState

func PBToEntityState(state pb.Entity_State) string

Types

type Certificate

type Certificate struct {
	gorm.Model

	Hash        []byte `gorm:"primary_key"`
	Certificate []byte
	Serial      []byte

	EntityHash []byte
	Entity     Entity

	Revoked bool

	NotBefore time.Time
	NotAfter  time.Time
}

func GetRevokedCertificates

func GetRevokedCertificates(db *gorm.DB) ([]Certificate, error)

func (Certificate) ParseCertificate

func (c Certificate) ParseCertificate() (*x509.Certificate, error)

func (Certificate) Pb

func (c Certificate) Pb() (*pb.Certificate, error)

type Entity

type Entity struct {
	gorm.Model

	Hash  []byte `gorm:"primary_key"`
	State string
	CSR   []byte

	Email        string
	Certificates []Certificate

	Longevity *string
	Expires   *time.Time
}

func (Entity) GetCertificate

func (entity Entity) GetCertificate(db *gorm.DB) (*Certificate, error)

func (Entity) GetCertificates

func (entity Entity) GetCertificates(db *gorm.DB) ([]Certificate, error)

func (Entity) ParseCertificateRequest

func (c Entity) ParseCertificateRequest() (*x509.CertificateRequest, error)

func (Entity) ToPb

func (c Entity) ToPb() (*pb.Entity, error)

Jump to

Keyboard shortcuts

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