mongocertstore

package
v6.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Mongo Cert Store

This package allows you to store autocerts (like Let's Encrypt) in a MongoDB database.

certStore := mongocertstore.NewCertCache(db, "certs")
// Provide this to your favorite HTTP library for storing certificates

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertCache

type CertCache struct {
	Collection database.Collection
	DB         database.Database
}

CertCache implements the autocert Cache interface and provides the ability to store SSL certs in the MongoDB.

func NewCertCache

func NewCertCache(db database.Database, collectionName string) *CertCache

NewCertCache creates a new SSL certificate cache in a MongoDB collection

func (*CertCache) Delete

func (cc *CertCache) Delete(ctx context.Context, key string) error

Delete removes a certificate from the database. The cert to remove is identified by a key

func (*CertCache) Get

func (cc *CertCache) Get(ctx context.Context, key string) ([]byte, error)

Get retrieves a certificate by key

func (*CertCache) Put

func (cc *CertCache) Put(ctx context.Context, key string, data []byte) error

Put inserts a certificate into the database

type CertCacheItem

type CertCacheItem struct {
	Certificate        []byte    `json:"certificate" bson:"certificate"`
	DateTimeCreatedUTC time.Time `json:"dateTimeCreatedUTC" bson:"dateTimeCreatedUTC"`
	Key                string    `json:"key" bson:"key"`
}

Jump to

Keyboard shortcuts

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