keystore

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IDsObjectKey is the redis object key for storing certificate IDs.
	IDsObjectKey = "ids"
	// CertObjectKey is the redis object key for storing certificates.
	CertObjectKey = "certificate"

	// PublicKey is the redis key of the certificate field.
	PublicKey = "public-key"
	// PrivateKeyKey is the redis key of the private key field.
	PrivateKeyKey = "private-key"
	// SaltKey is the redis key of the salt field.
	SaltKey = "salt"
)
View Source
var ErrIDAlreadyExists = errors.New("record with the id already exists")

ErrIDAlreadyExists is returned if an ID is already in use.

View Source
var ErrInvalidDecryptionKey = errors.New("given password can't decrypt the message")

ErrInvalidDecryptionKey is returned if the given password for the decryption is invalid and can't be used.

View Source
var ErrReachedMaxAttempts = errors.New("maximum number of attempts reached")

ErrReachedMaxAttempts is returned if the maximum number of attempts of transactions is reached.

View Source
var ErrRecordNotFound = errors.New("record not found")

ErrRecordNotFound is returned if a record can't be found.

Functions

func ToCertObjectKey added in v0.6.0

func ToCertObjectKey(id string) string

ToCertObjectKey converts a certificate ID to a keystore object key.

Types

type KeyPair

type KeyPair struct {
	Cert *x509.Certificate
	PK   *rsa.PrivateKey
}

KeyPair represents a combination of a certificate and a private key.

type Service

type Service interface {
	Ping(ctx context.Context) error
	Store(ctx context.Context, id string, password []byte, kp *KeyPair) error
	Get(ctx context.Context, id string, password []byte) (*KeyPair, error)
	List(ctx context.Context, start, end int64) ([]string, error)
	UpdateID(ctx context.Context, oldID, newID string) error
	UpdatePassword(ctx context.Context, id string, oldPassword, newPassword []byte) error
	Delete(ctx context.Context, id string) error
}

Service represents a keystore abstraction for KeyPair management.

func NewRedisService added in v0.3.0

func NewRedisService(rdb *redis.Client) Service

NewRedisService returns an implementation of the Service.

Jump to

Keyboard shortcuts

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