db

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StaticResolver

func StaticResolver(url string) func(service, region string, opts ...interface{}) (aws.Endpoint, error)

StaticResolver is used in test and dev to use the local dynamodb

Types

type CertKey

type CertKey struct {
	SerialNumber []byte `dynamodbav:"SN"`
}

CertKey is the DynamoDB primary key, which is the serial number.

func NewCertKey

func NewCertKey(sn *big.Int) CertKey

func (CertKey) SerialString

func (ck CertKey) SerialString() string

SerialString returns a consistent string representation of a SerialNumber It is intended for use as a map key, and is equivalent to boulder's SerialToString

type CertMetadata

type CertMetadata struct {
	CertKey
	RevocationTime time.Time `dynamodbav:"RT,unixtime"`
}

CertMetadata is the entire set of attributes stored in Dynamo. That is the CertKey plus the revocation time today.

type Database

type Database struct {
	Table  string
	Dynamo ddb
}

func New

func New(ctx context.Context, table, dynamoEndpoint string) (*Database, error)

func (*Database) AddCert

func (db *Database) AddCert(ctx context.Context, certificate *x509.Certificate, revocationTime time.Time) error

AddCert inserts the metadata for monitoring

func (*Database) DeleteSerials

func (db *Database) DeleteSerials(ctx context.Context, serialNumbers [][]byte) error

DeleteSerials takes a list of serials that we've seen in the CRL and thus no longer need to keep an eye out for.

func (*Database) GetAllCerts

func (db *Database) GetAllCerts(ctx context.Context) (map[string]CertMetadata, error)

GetAllCerts returns all the certificates in the DynamoDB. This set is intended to be much smaller than the set of certificates in a CRL, so it's more efficient to just load the entire set instead of conditional querying. The map key is the serial's CertKey.SerialString. TODO: This could be more efficient if it was a query over issuer or shard TODO: However, the dataset is small enough to not matter much.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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