keydb

package
v0.0.0-...-d0e8f4b Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExpiredTTL indicates the key has expired
	ErrExpiredTTL = errors.New("Key has expired")
	// ErrOutdatedValue indicates the timestamp is less than the currently known timestamp
	ErrOutdatedValue = errors.New("outdated value attempting to be used as an update")
	// ErrPubkeyDoesNotMatch specified pubkey does not match provided addreess
	ErrPubkeyDoesNotMatch = errors.New("pubKey does not match address")
	// ErrSignatureMismatch indicates an invalid signature specified for the payload
	ErrSignatureMismatch = errors.New("Signature does match")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DBPath string
}

Config is the configuration for creating a new keyDb instance

type KeyDB

type KeyDB struct {
	// contains filtered or unexported fields
}

KeyDB is an implementation of a kv store which is permissioned using pubkey based authentication

func New

func New(config *Config) (*KeyDB, error)

New returns a new KeyDB that can be used by the keytp server.

func (*KeyDB) Close

func (db *KeyDB) Close()

Close closed down the db, and releases the lock on the db file

func (*KeyDB) Get

func (db *KeyDB) Get(keyAddress string) (*models.AddressMetadata, error)

Get pulls a key from the database, and returns it to the called. It does not validate the output data and expects that the integrety of values was ensured during SetKey()

func (*KeyDB) Set

func (db *KeyDB) Set(keyAddress string, metadata *models.AddressMetadata) error

Set expects to take a cryptocurrency address and update a key in the DB backend if the payload is valid under the key provided.

Jump to

Keyboard shortcuts

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