Documentation ¶
Overview ¶
Package certs contains the domain concept definitions needed to support Magistrala certs service functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFailedCertCreation failed to create certificate. ErrFailedCertCreation = errors.New("failed to create client certificate") // ErrFailedCertRevocation failed to revoke certificate. ErrFailedCertRevocation = errors.New("failed to revoke certificate") ErrFailedToRemoveCertFromDB = errors.New("failed to remove cert serial from db") ErrFailedReadFromPKI = errors.New("failed to read certificate from PKI") )
View Source
var ErrMissingCerts = errors.New("CA path or CA key path not set")
Functions ¶
func LoadCertificates ¶
func LoadCertificates(caPath, caKeyPath string) (tls.Certificate, *x509.Certificate, error)
Types ¶
type Cert ¶
type Cert struct { OwnerID string `json:"owner_id" mapstructure:"owner_id"` ThingID string `json:"thing_id" mapstructure:"thing_id"` ClientCert string `json:"client_cert" mapstructure:"certificate"` IssuingCA string `json:"issuing_ca" mapstructure:"issuing_ca"` CAChain []string `json:"ca_chain" mapstructure:"ca_chain"` ClientKey string `json:"client_key" mapstructure:"private_key"` PrivateKeyType string `json:"private_key_type" mapstructure:"private_key_type"` Serial string `json:"serial" mapstructure:"serial_number"` Expire time.Time `json:"expire" mapstructure:"-"` }
Cert defines the certificate paremeters.
type Repository ¶
type Repository interface { // Save saves cert for thing into database Save(ctx context.Context, cert Cert) (string, error) // RetrieveAll retrieve issued certificates for given owner ID RetrieveAll(ctx context.Context, ownerID string, offset, limit uint64) (Page, error) // Remove removes certificate from DB for a given thing ID Remove(ctx context.Context, ownerID, thingID string) error // RetrieveByThing retrieves issued certificates for a given thing ID RetrieveByThing(ctx context.Context, ownerID, thingID string, offset, limit uint64) (Page, error) // RetrieveBySerial retrieves a certificate for a given serial ID RetrieveBySerial(ctx context.Context, ownerID, serialID string) (Cert, error) }
Repository specifies a Config persistence API.
type Service ¶
type Service interface { // IssueCert issues certificate for given thing id if access is granted with token IssueCert(ctx context.Context, token, thingID, ttl string) (Cert, error) // ListCerts lists certificates issued for a given thing ID ListCerts(ctx context.Context, token, thingID string, offset, limit uint64) (Page, error) // ListSerials lists certificate serial IDs issued for a given thing ID ListSerials(ctx context.Context, token, thingID string, offset, limit uint64) (Page, error) // ViewCert retrieves the certificate issued for a given serial ID ViewCert(ctx context.Context, token, serialID string) (Cert, error) // RevokeCert revokes a certificate for a given serial ID RevokeCert(ctx context.Context, token, serialID string) (Revoke, error) }
Service specifies an API that must be fulfilled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶
func New(auth magistrala.AuthServiceClient, certs Repository, sdk mgsdk.SDK, pkiAgent pki.Agent) Service
New returns new Certs service.
Directories ¶
Path | Synopsis |
---|---|
Package api contains implementation of certs service HTTP API.
|
Package api contains implementation of certs service HTTP API. |
Package mocks contains mocks for testing purposes.
|
Package mocks contains mocks for testing purposes. |
Package pki contains the domain concept definitions needed to support Magistrala Certs service functionality.
|
Package pki contains the domain concept definitions needed to support Magistrala Certs service functionality. |
Package postgres contains repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains repository implementations using PostgreSQL as the underlying database. |
Package tracing provides tracing instrumentation for Magistrala Users Groups service.
|
Package tracing provides tracing instrumentation for Magistrala Users Groups service. |
Click to show internal directories.
Click to hide internal directories.