views

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package views defines the public JSON schema of inventory objects shared by the CLI (--json/--yaml) and the REST API. Internal database rows are never serialised directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertStatus

func CertStatus(nb, na time.Time, isCA bool, e Expiry, now time.Time) (string, int)

CertStatus classifies a certificate: EXPIRED, NOT_YET_VALID, CRITICAL, WARNING, CA or OK, and returns the whole days remaining.

Types

type CTObservation

type CTObservation struct {
	ID         string    `json:"id"`
	Watch      string    `json:"watch,omitempty"`
	Status     string    `json:"status"`
	Reason     string    `json:"reason"`
	DNSNames   []string  `json:"dns_names"`
	Issuer     string    `json:"issuer"`
	IssuerName string    `json:"issuer_name,omitempty"`
	NotBefore  time.Time `json:"not_before"`
	NotAfter   time.Time `json:"not_after"`
	CertSHA256 string    `json:"cert_sha256,omitempty"`
	Serial     string    `json:"serial,omitempty"`
	Provider   string    `json:"provider"`
	ExternalID string    `json:"provider_id"`
	Revoked    *bool     `json:"revoked,omitempty"`
	KnownCert  string    `json:"known_certificate,omitempty"`
	Acked      bool      `json:"acknowledged"`
	FirstSeen  time.Time `json:"first_seen"`
}

CTObservation describes one CT observation.

func NewCTObservation

func NewCTObservation(o database.CTObservation, watch string) CTObservation

NewCTObservation converts a stored observation.

type CertSummary

type CertSummary struct {
	ID                 string    `json:"id"`
	Name               string    `json:"name,omitempty"`
	CommonName         string    `json:"common_name"`
	Subject            string    `json:"subject"`
	Issuer             string    `json:"issuer"`
	SANs               []string  `json:"sans"`
	NotBefore          time.Time `json:"not_before"`
	NotAfter           time.Time `json:"not_after"`
	DaysRemaining      int       `json:"days_remaining"`
	Status             string    `json:"status"`
	Key                string    `json:"key"`
	SignatureAlgorithm string    `json:"signature_algorithm"`
	IsCA               bool      `json:"is_ca"`
	SelfSigned         bool      `json:"self_signed"`
	SHA256             string    `json:"sha256"`
	Serial             string    `json:"serial"`
	Tags               []string  `json:"tags"`
	KeyID              string    `json:"key_id,omitempty"`
	IssuerID           string    `json:"issuer_id,omitempty"`
	CTMonitored        bool      `json:"ct_monitored"`
	Source             string    `json:"source"`
	Comment            string    `json:"comment,omitempty"`
	ImportedAt         time.Time `json:"imported_at"`
}

CertSummary describes a stored certificate in listings.

func Summarize

func Summarize(c *database.Certificate, e Expiry) CertSummary

Summarize converts a stored certificate.

func SummarizeAll

func SummarizeAll(certs []*database.Certificate, e Expiry) []CertSummary

SummarizeAll converts a list (never nil).

type Expiry

type Expiry struct {
	WarningDays  int
	CriticalDays int
}

Expiry holds the configured warning thresholds.

type Key

type Key struct {
	ID             string    `json:"id"`
	Name           string    `json:"name,omitempty"`
	Algorithm      string    `json:"algorithm"`
	Bits           int       `json:"bits"`
	Description    string    `json:"description"`
	SPKISHA256     string    `json:"spki_sha256"`
	SSHFingerprint string    `json:"ssh_fingerprint,omitempty"`
	HasPrivate     bool      `json:"has_private_key"`
	Source         string    `json:"source"`
	Comment        string    `json:"comment,omitempty"`
	Tags           []string  `json:"tags"`
	ImportedAt     time.Time `json:"imported_at"`
	Certificates   []string  `json:"certificates,omitempty"`
}

Key describes a stored key; it never contains key material.

func NewKey

func NewKey(k *database.Key) Key

NewKey converts a stored key.

type SSHInfo

type SSHInfo = sshkeys.Info

SSHInfo is re-exported for API consumers.

type SSHKey

type SSHKey struct {
	ID          string    `json:"id"`
	Name        string    `json:"name,omitempty"`
	Type        string    `json:"type"`
	Bits        int       `json:"bits"`
	Fingerprint string    `json:"fingerprint_sha256"`
	Comment     string    `json:"comment,omitempty"`
	HasPrivate  bool      `json:"has_private_key"`
	Passphrase  bool      `json:"passphrase_protected"`
	PublicKey   string    `json:"public_key"`
	Source      string    `json:"source"`
	Tags        []string  `json:"tags"`
	ImportedAt  time.Time `json:"imported_at"`
}

SSHKey describes a stored SSH key; it never contains private material.

func NewSSHKey

func NewSSHKey(k *database.SSHKey) SSHKey

NewSSHKey converts a stored SSH key.

Jump to

Keyboard shortcuts

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