store

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertRecord

type CertRecord struct {
	ID         int         `json:"-" db:"id"`
	KeyID      string      `json:"key_id" db:"key_id"`
	Principals StringSlice `json:"principals" db:"principals"`
	CreatedAt  time.Time   `json:"created_at" db:"created_at"`
	Expires    time.Time   `json:"expires" db:"expires_at"`
	Revoked    bool        `json:"revoked" db:"revoked"`
	Raw        string      `json:"-" db:"raw_key"`
	Message    string      `json:"message" db:"message"`
}

A CertRecord is a representation of a ssh certificate used by a CertStorer.

func MakeRecord added in v1.2.0

func MakeRecord(cert *ssh.Certificate) *CertRecord

MakeRecord converts a Certificate to a CertRecord

func (*CertRecord) MarshalJSON

func (c *CertRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the CreatedAt and Expires fields. The resulting string looks like "2017-04-11 10:00:00 +0000"

type CertStorer

type CertStorer interface {
	Get(id string) (*CertRecord, error)
	SetRecord(record *CertRecord) error
	List(includeExpired bool) ([]*CertRecord, error)
	Revoke(id []string) error
	GetRevoked() ([]*CertRecord, error)
	Close() error
}

CertStorer records issued certs in a persistent store for audit and revocation purposes.

func New

func New(c config.Database) (CertStorer, error)

New returns a new configured database.

type StringSlice added in v1.1.0

type StringSlice []string

StringSlice is a []string which will be stored in a database as a JSON array.

func (*StringSlice) Scan added in v1.1.0

func (s *StringSlice) Scan(value interface{}) error

Scan implements the sql.Scanner interface, unmarshalling the value coming off the wire and storing the result in the StringSlice.

func (StringSlice) Value added in v1.1.0

func (s StringSlice) Value() (driver.Value, error)

Value implements the driver.Valuer interface, marshalling the raw value to a JSON array.

Jump to

Keyboard shortcuts

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