keypair

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeypairNotFound      = errors.New("keypair not found")
	ErrKeypairAlreadyExists = errors.New("keypair already exists")
)

Functions

func RegisterStoreConstructor

func RegisterStoreConstructor(storeType string, constructor StoreConstructor)

RegisterStoreConstructor registers a StoreConstructor of type storeType to be used to create a keystore.

Types

type Keystore

type Keystore interface {
	// Put puts the provided full keypair into storage.
	//
	// ErrKeypairAlreadyExists is returned if a keypair with that id already exists.
	Put(ctx context.Context, id string, full *keypair.Full) error

	// Get fetches a keypair by id, if it exists in the store.
	//
	// ErrKeypairNotFound is returned if the keypair could not be found in the store.
	Get(ctx context.Context, id string) (*keypair.Full, error)
}

func CreateStore

func CreateStore(storeType string) (Keystore, error)

CreateStore creates a Keystore of type storeType using the StoreConstructor of that type, if one has been registered. If no constructor has been registered with the specified type, an error is thrown

type StoreConstructor

type StoreConstructor func() (Keystore, error)

A StoreConstructor creates a Keystore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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