schema

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaName   = "cert"
	RootCertName = "$root$"
)
View Source
const (
	// DefaultCACertExpiry is the default validity period for intermediate
	// certificate authorities.
	DefaultCACertExpiry = 5 * 365 * 24 * time.Hour

	// DefaultCertExpiry is the default validity period for leaf certificates.
	DefaultCertExpiry = 90 * 24 * time.Hour
)
View Source
const (
	// Maximum number of subjects to return in a list query
	SubjectListLimit = 100

	// Maximum number of certificates to return in a list query
	CertListLimit = 100
)

Variables

View Source
var Objects string
View Source
var Queries string

Functions

This section is empty.

Types

type Cert

type Cert struct {
	ID uint64 `json:"-" readonly:""`
	CertKey
	Signer    *CertKey    `json:"signer,omitempty" jsonschema:"certificate authority that signed this certificate"`
	Subject   *SubjectRef `json:"subject,omitempty" readonly:"" jsonschema:"certificate subject details"`
	SubjectID *uint64     `json:"-"`
	SAN       []string    `` /* 172-byte string literal not displayed */
	NotBefore time.Time   `json:"not_before,omitzero" jsonschema:"start of certificate validity period" example:"2026-01-01T00:00:00Z"`
	NotAfter  time.Time   `json:"not_after,omitzero" jsonschema:"end of certificate validity period" example:"2027-01-01T00:00:00Z"`
	IsCA      bool        `json:"is_ca,omitempty" jsonschema:"whether this is a certificate authority" example:"false"`
	CertMeta
	Cert          []byte    `json:"cert,omitempty" jsonschema:"DER-encoded certificate data"`
	EffectiveTags []string  `` /* 129-byte string literal not displayed */
	Ts            time.Time `json:"timestamp,omitzero" jsonschema:"last modification timestamp"`
}

Certificate

func (Cert) IsRoot

func (c Cert) IsRoot() bool

func (*Cert) Scan

func (c *Cert) Scan(row pg.Row) error

func (Cert) String

func (c Cert) String() string

type CertBundle

type CertBundle struct {
	Cert
	Chain []Cert `json:"chain,omitempty" readonly:""`
	Key   []byte `json:"key,omitempty" readonly:""`
}

func (CertBundle) String

func (c CertBundle) String() string

type CertKey

type CertKey struct {
	Name   string `json:"name" example:"my_cert"`
	Serial string `json:"serial" example:"123456789"`
}

Certificate key

func (CertKey) Select

func (c CertKey) Select(bind *pg.Bind, op pg.Op) (string, error)

func (CertKey) String

func (c CertKey) String() string

type CertList

type CertList struct {
	CertListRequest
	Count uint64 `json:"count"`
	Body  []Cert `json:"body,omitempty"`
}

func (*CertList) Scan

func (c *CertList) Scan(row pg.Row) error

func (*CertList) ScanCount

func (c *CertList) ScanCount(row pg.Row) error

func (CertList) String

func (c CertList) String() string

type CertListRequest

type CertListRequest struct {
	pg.OffsetLimit
	IsCA    *bool    `json:"is_ca,omitempty" jsonschema:"filter by certificate authority status" example:"true"`
	Enabled *bool    `json:"enabled,omitempty" negatable:"" jsonschema:"filter by effective enabled state" example:"true"`
	Tags    []string `json:"tags,omitempty" jsonschema:"require all specified effective tags" example:"[\"production\"]"`
	Valid   *bool    `json:"valid,omitempty" jsonschema:"filter by current validity window" example:"true"`
	Subject *uint64  `json:"subject,omitempty" jsonschema:"filter by subject row identifier" example:"1"`
}

func (CertListRequest) Select

func (c CertListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (CertListRequest) String

func (c CertListRequest) String() string

type CertMeta

type CertMeta struct {
	Enabled *bool    `json:"enabled,omitempty" negatable:""`
	Tags    []string `json:"tags,omitempty"`
}

Certificate Metadata

func (CertMeta) Insert

func (c CertMeta) Insert(bind *pg.Bind) (string, error)

func (CertMeta) String

func (c CertMeta) String() string

func (CertMeta) Update

func (c CertMeta) Update(bind *pg.Bind) error

type CertName

type CertName string

Certificate Name

func (CertName) Select

func (c CertName) Select(bind *pg.Bind, op pg.Op) (string, error)

type CertWithPrivateKey

type CertWithPrivateKey struct {
	Cert
	PV  uint64 `json:"pv,omitempty" readonly:"" jsonschema:"private key version"`
	Key []byte `json:"key,omitempty" jsonschema:"DER-encoded private key data"`
}

Composite of Cert and private key for select

func (CertWithPrivateKey) Insert

func (c CertWithPrivateKey) Insert(bind *pg.Bind) (string, error)

func (*CertWithPrivateKey) Scan

func (c *CertWithPrivateKey) Scan(row pg.Row) error

func (CertWithPrivateKey) String

func (c CertWithPrivateKey) String() string

type CreateCertRequest

type CreateCertRequest struct {
	Name    string        `json:"name,omitempty" jsonschema:"unique certificate name" example:"my_cert"`
	Expiry  time.Duration `json:"expiry,omitempty" jsonschema:"certificate validity duration" example:"8760h"`
	Subject *SubjectMeta  `json:"subject,omitempty" optional:"" jsonschema:"certificate subject details"`
	SAN     []string      `` /* 172-byte string literal not displayed */
	Tags    []string      `json:"tags,omitempty" jsonschema:"labels for grouping and filtering certificates" example:"[\"tag1\",\"tag2\"]"`
}

func (CreateCertRequest) String

func (c CreateCertRequest) String() string

type PrivateCertKey

type PrivateCertKey struct {
	Name   string `json:"name"`
	Serial string `json:"serial"`
}

Key for retrieving private certificate

func (PrivateCertKey) Select

func (c PrivateCertKey) Select(bind *pg.Bind, op pg.Op) (string, error)

type PrivateCertName

type PrivateCertName string

Name for retrieving private certificate

func (PrivateCertName) Select

func (c PrivateCertName) Select(bind *pg.Bind, op pg.Op) (string, error)

type RenewCertRequest

type RenewCertRequest struct {
	Expiry  time.Duration `json:"expiry,omitempty" jsonschema:"new certificate validity duration" example:"8760h"`
	Subject *SubjectMeta  `json:"subject,omitempty" jsonschema:"updated certificate subject details"`
}

func (RenewCertRequest) String

func (c RenewCertRequest) String() string

type Subject

type Subject struct {
	ID uint64 `json:"id"`
	SubjectMeta
	Ts      time.Time `json:"timestamp,omitzero"`
	Subject *string   `json:"subject,omitempty"`
}

func (*Subject) Scan

func (n *Subject) Scan(row pg.Row) error

func (Subject) String

func (n Subject) String() string

type SubjectID

type SubjectID uint64

func (SubjectID) Select

func (n SubjectID) Select(bind *pg.Bind, op pg.Op) (string, error)

type SubjectList

type SubjectList struct {
	SubjectListRequest
	Count uint64    `json:"count"`
	Body  []Subject `json:"body,omitempty"`
}

func (*SubjectList) Scan

func (n *SubjectList) Scan(row pg.Row) error

func (*SubjectList) ScanCount

func (n *SubjectList) ScanCount(row pg.Row) error

func (SubjectList) String

func (n SubjectList) String() string

type SubjectListRequest

type SubjectListRequest struct {
	pg.OffsetLimit
}

func (SubjectListRequest) Select

func (n SubjectListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (SubjectListRequest) String

func (n SubjectListRequest) String() string

type SubjectMeta

type SubjectMeta struct {
	Org           *string `json:"organizationName,omitempty" example:"Example Corp"`
	Unit          *string `json:"organizationalUnit,omitempty" example:"IT Department"`
	Country       *string `json:"countryName,omitempty" example:"US"`
	City          *string `json:"localityName,omitempty" example:"San Francisco"`
	State         *string `json:"stateOrProvinceName,omitempty" example:"California"`
	StreetAddress *string `json:"streetAddress,omitempty" example:"123 Main St"`
	PostalCode    *string `json:"postalCode,omitempty" example:"94105"`
}

func MergeSubjectMeta

func MergeSubjectMeta(base SubjectMeta, patch *SubjectMeta) SubjectMeta

func SubjectMetaFromPKIXName

func SubjectMetaFromPKIXName(subject pkix.Name) SubjectMeta

func (SubjectMeta) Insert

func (n SubjectMeta) Insert(bind *pg.Bind) (string, error)

func (SubjectMeta) String

func (n SubjectMeta) String() string

func (SubjectMeta) Update

func (n SubjectMeta) Update(bind *pg.Bind) error

type SubjectRef

type SubjectRef struct {
	ID uint64 `json:"-"`
	SubjectMeta
	Ts         time.Time `json:"timestamp,omitzero"`
	CommonName *string   `json:"commonName,omitempty"`
	Name       *string   `json:"name,omitempty"`
}

func SubjectRefFromMeta

func SubjectRefFromMeta(id uint64, meta SubjectMeta, ts time.Time, commonName *string) SubjectRef

func (SubjectRef) String

func (n SubjectRef) String() string

Jump to

Keyboard shortcuts

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