keystore: zntr.io/keystore Index | Files | Directories

package keystore

import "zntr.io/keystore"

Index

Package Files

keystore.go keystore_inmem.go keystore_vault.go

Variables

var (
    // ErrNotImplemented is raised when calling not implemented method
    ErrNotImplemented = errors.New("keystore: Method not implemented")
    // ErrKeyNotFound is raised when trying to get inexistant key from keystore
    ErrKeyNotFound = errors.New("keystore: Key not found")
    // ErrGeneratorNeedPositiveValueAboveOne is raised when caller gives a value under 1 as count
    ErrGeneratorNeedPositiveValueAboveOne = errors.New("keystore: Key generation count needs positive above 1 value as count")
)

type Expirable Uses

type Expirable interface {
    ExpiresAt(time.Time)
    IsExpired() bool
    NeverExpires()
}

Expirable is a behaviour for a key

type KeyGenerator Uses

type KeyGenerator func() (key.Key, error)

KeyGenerator is the key builder to use for the keystore

type KeyStore Uses

type KeyStore interface {
    All() ([]key.Key, error)
    OnlyPublicKeys() ([]key.Key, error)
    Add(key.Key) error
    AddWithExpiration(key.Key, time.Duration) error
    Get(string) (key.Key, error)
    Remove(string) error
    RotateKeys(context.Context) error
    Pick() (key.Key, error)
    Generate() (key.Key, error)
}

KeyStore contract

func NewInMemory Uses

func NewInMemory(generator KeyGenerator) (KeyStore, error)

NewInMemory returns an in-memory map based keystore

func NewVault Uses

func NewVault(generator KeyGenerator, prefix string) (KeyStore, error)

NewVault returns a vault based keystore

Directories

PathSynopsis
key

Package keystore imports 11 packages (graph). Updated 2020-06-30. Refresh now. Tools for package owners.