func (b *Bolt) Add(caName, name string, isCa bool, key, cert []byte) error {
	return b.DB.Update(func(tx *bolt.Tx) error {
		kb, cb, err := buckets(tx, caName)
		if err != nil {
			return err
		}
		k := []byte(name)
		if err := kb.Put(k, key); err != nil {
			return fmt.Errorf("failed puting %v key into %v keys bucket: %v", name, caName, err)
		}
		if err := cb.Put(k, cert); err != nil {
			return fmt.Errorf("failed puting %v cert into %v certs bucket: %v", name, caName, err)
		}
		if isCa && name != caName {
			kb, cb, err = buckets(tx, name)
			if err != nil {
				return err
			}
			if err := kb.Put(k, key); err != nil {
				return fmt.Errorf("failed puting %v key into %v keys bucket: %v", name, name, err)
			}
			if err := cb.Put(k, cert); err != nil {
				return fmt.Errorf("failed puting %v cert into %v certs bucket: %v", name, name, err)
			}
		}
		return nil
	})
}
Add adds the given bundle to the database.
package store
import (
	"crypto/x509/pkix"
	"errors"
	"math/big"
	"time"
	"fmt"
	"github.com/boltdb/bolt"
	"github.com/google/easypki/pkg/certificate"
)
var (
	keysBucketKey    = []byte("keys")
	certsBucketKey   = []byte("certs")
	revokedBucketKey = []byte("revoked")
)
var (
	ErrDoesNotExist = errors.New("does not exist")
)
type Bolt struct {
	DB *bolt.DB
}