cadb

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaDb

type CaDb interface {
	db.IDGenerator
	CaReadonlyDb
	// RegisterRootCertificate registers Root Cert
	RegisterRootCertificate(ctx context.Context, crt *model.RootCertificate) (*model.RootCertificate, error)
	// RemoveRootCertificate removes Root Cert
	RemoveRootCertificate(ctx context.Context, id uint64) error

	// RegisterCertificate registers Certificate
	RegisterCertificate(ctx context.Context, crt *model.Certificate) (*model.Certificate, error)
	// RemoveCertificate removes Certificate
	RemoveCertificate(ctx context.Context, id uint64) error

	// RegisterRevokedCertificate registers revoked Certificate
	RegisterRevokedCertificate(ctx context.Context, revoked *model.RevokedCertificate) (*model.RevokedCertificate, error)
	// RemoveRevokedCertificate removes revoked Certificate
	RemoveRevokedCertificate(ctx context.Context, id uint64) error
	// RevokeCertificate removes Certificate and creates RevokedCertificate
	RevokeCertificate(ctx context.Context, crt *model.Certificate, at time.Time, reason int) (*model.RevokedCertificate, error)

	// RegisterCrl registers CRL
	RegisterCrl(ctx context.Context, crt *model.Crl) (*model.Crl, error)
	// RemoveCrl removes CRL
	RemoveCrl(ctx context.Context, id uint64) error

	// CreateNonce returns Nonce
	CreateNonce(ctx context.Context, nonce *model.Nonce) (*model.Nonce, error)
	// UseNonce returns Nonce if nonce matches, and was not used
	UseNonce(ctx context.Context, nonce string) (*model.Nonce, error)
	// DeleteNonce deletes the nonce
	DeleteNonce(ctx context.Context, id uint64) error
}

CaDb defines an interface for CRUD operations on Certs

type CaReadonlyDb

type CaReadonlyDb interface {
	// GetRootCertificatesr returns list of Root certs
	GetRootCertificates(ctx context.Context) (model.RootCertificates, error)
	// GetOrgCertificates returns Certificates for organization
	GetOrgCertificates(ctx context.Context, orgID uint64) (model.Certificates, error)
	// GetCertificate returns registered Certificate
	GetCertificate(ctx context.Context, id uint64) (*model.Certificate, error)
	// GetCertificateBySKID returns registered Certificate
	GetCertificateBySKID(ctx context.Context, skid string) (*model.Certificate, error)
	// GetOrgRevokedCertificates returns list of Org's revoked certificates
	GetOrgRevokedCertificates(ctx context.Context, orgID uint64) (model.RevokedCertificates, error)
	// GetCrl returns CRL by a specified issuer
	GetCrl(ctx context.Context, ikid string) (*model.Crl, error)
	// ListRevokedCertificates returns revoked certificates info by a specified issuer
	ListRevokedCertificates(ctx context.Context, ikid string, limit int, afterID uint64) (model.RevokedCertificates, error)
	// ListCertificates returns list of Certificate info
	ListCertificates(ctx context.Context, ikid string, limit int, afterID uint64) (model.Certificates, error)

	// GetCertsCount returns number of certs
	GetCertsCount(ctx context.Context) (uint64, error)
	// GetRevokedCount returns number of revoked certs
	GetRevokedCount(ctx context.Context) (uint64, error)
}

CaReadonlyDb defines an interface for Read operations on Certs

type Provider

type Provider interface {
	db.IDGenerator
	CaDb

	// DB returns underlying DB connection
	DB() *sql.DB

	// Close connection and release resources
	Close() (err error)
}

Provider provides complete DB access

func New

func New(driverName, dataSourceName, migrationsDir string, forceVersion int, nextID func() (uint64, error)) (Provider, error)

New creates a Provider instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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