keystore

package
v0.0.0-...-a47b674 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//RESTkeystoreURL is our keystore service URL
	RESTkeystoreURL = "http://keystore.us-west-2.adrianosela.com"
)

Functions

This section is empty.

Types

type Keystore

type Keystore interface {
	SetKeyPair(string, *rsa.PrivateKey, time.Duration) error
	GetPubKeys() (map[string]*rsa.PublicKey, error)
	GetSigningKey() (*rsa.PrivateKey, string, error)
	SharePubKeyHandler(http.ResponseWriter, *http.Request)
}

Keystore represents an interface capable of storing and fetching public Keys

type RESTKeystore

type RESTKeystore struct {
	sync.RWMutex //inherit read/write lock behavior
	HTTPClient   http.Client
	CachedKeys   map[string]*api.KeyMetadata `json:"keys"`
	SigningKey   *rsa.PrivateKey
	SigningKeyID string
}

RESTKeystore is a client of my own REST keystore found in github.com/adrianosela/Keystore

func NewRESTKeystore

func NewRESTKeystore() (*RESTKeystore, error)

NewRESTKeystore returns the addr of a new keystore object

func (*RESTKeystore) GetPubKeys

func (ks *RESTKeystore) GetPubKeys() (map[string]*rsa.PublicKey, error)

func (*RESTKeystore) GetSigningKey

func (ks *RESTKeystore) GetSigningKey() (*rsa.PrivateKey, string, error)

GetSigningKey returns the signing key along its ID and nil error if success

func (*RESTKeystore) SetKeyPair

func (ks *RESTKeystore) SetKeyPair(keyID string, keyPair *rsa.PrivateKey, lifespan time.Duration) error

SavePubKey will cache a given key locally as well as publish it to the RESTKeystore

func (*RESTKeystore) SharePubKeyHandler

func (ks *RESTKeystore) SharePubKeyHandler(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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