internal

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoArguments = errors.New("not enough arguments")
	ErrBadRealm    = errors.New("invalid realm: non-word characters")
)
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type BoltDB

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

func NewBoltDB

func NewBoltDB(fpath string) (*BoltDB, error)

func (*BoltDB) Close

func (b *BoltDB) Close() error

func (*BoltDB) DropKey

func (b *BoltDB) DropKey(realm, key string) error

func (*BoltDB) GetAllKeys

func (b *BoltDB) GetAllKeys(realm string) (s Stored, err error)

func (*BoltDB) GetKey

func (b *BoltDB) GetKey(realm, key string) (s Sealed, err error)

func (*BoltDB) ListKeys

func (b *BoltDB) ListKeys(realm string) (s []string, err error)

func (*BoltDB) ListRealms

func (b *BoltDB) ListRealms() (s []string, err error)

func (*BoltDB) Purge

func (b *BoltDB) Purge(realm string) error

func (*BoltDB) SetKey

func (b *BoltDB) SetKey(realm, key string, s Sealed) error

func (*BoltDB) SetKeys

func (b *BoltDB) SetKeys(realm string, s Stored) error

type DB

type DB interface {
	SetKey(realm, key string, data Sealed) error
	GetKey(realm, key string) (Sealed, error)
	DropKey(realm, key string) error
	ListKeys(realm string) ([]string, error)
	ListRealms() ([]string, error)
	Purge(realm string) error
	GetAllKeys(realm string) (Stored, error)
	SetKeys(realm string, keys Stored) error
	Close() error
}

DB exists in case we want to mock the DB later.

type Extractor

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

func NewExtractor

func NewExtractor(args []string) (*Extractor, error)

func (*Extractor) Args

func (e *Extractor) Args() []string

func (*Extractor) Realm

func (e *Extractor) Realm() string

func (*Extractor) Values

func (e *Extractor) Values() map[string]string

type KeyGenerator

type KeyGenerator interface {
	MakeKey() ([]byte, error)
}

type Keychain

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

func NewKeychain

func NewKeychain() (*Keychain, error)

func (*Keychain) GetSecret

func (k *Keychain) GetSecret() ([]byte, error)

func (*Keychain) GetUsername

func (k *Keychain) GetUsername() string

type Loaded

type Loaded map[string]Unsealed

type Noncer

type Noncer interface {
	GetNonce() ([]byte, error)
}

type Ring

type Ring interface {
	GetSecret() ([]byte, error)
	GetUsername() string
}

type Sealed

type Sealed struct {
	Data string `json:"data"`
	Meta string `json:"metadata"`
}

type Sealer

type Sealer struct {
	Ring
	// contains filtered or unexported fields
}

func NewDefaultSealer

func NewDefaultSealer() (*Sealer, error)

func NewSealer

func NewSealer(r Ring, n Noncer) (*Sealer, error)

func NewTestSealer

func NewTestSealer() *Sealer

func (Sealer) Seal

func (s Sealer) Seal(ud Unsealed) (Sealed, error)

func (Sealer) Unseal

func (s Sealer) Unseal(sd Sealed) (Unsealed, error)

type Stored

type Stored map[string]Sealed

type Unsealed

type Unsealed struct {
	Data string
	Meta metadata
}

Jump to

Keyboard shortcuts

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