aes_store

package
v0.0.0-...-6af2dc9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = aes.BlockSize

Variables

This section is empty.

Functions

This section is empty.

Types

type AesKey

type AesKey struct {
	KeyBytes []byte
}

func (AesKey) Decrypt

func (a AesKey) Decrypt(data []byte) ([]byte, error)

func (AesKey) Encrypt

func (a AesKey) Encrypt(data []byte) ([]byte, error)

func (AesKey) Key

func (a AesKey) Key() string

func (AesKey) KeyRaw

func (a AesKey) KeyRaw() []byte

type AesStore

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

func (*AesStore) Get

func (a *AesStore) Get(name string) Key

func (*AesStore) GetOrNew

func (a *AesStore) GetOrNew(name string) (Key, bool)

func (*AesStore) New

func (a *AesStore) New(name string) Key

func (*AesStore) Revive

func (a *AesStore) Revive(name string)

func (*AesStore) Stop

func (a *AesStore) Stop()

func (*AesStore) Store

func (a *AesStore) Store(name string, key []byte)

type Key

type Key interface {
	Key() string
	KeyRaw() []byte
	Encrypt(data []byte) ([]byte, error)
	Decrypt(data []byte) ([]byte, error)
}

type MockAesStore

type MockAesStore struct {
	NewFunc      func(name string) Key
	GetFunc      func(name string) Key
	GetOrNewFunc func(name string) (Key, bool)
	StoreFunc    func(name string, key []byte)
	ReviveFunc   func(name string)
	StopFunc     func()
}

func (MockAesStore) Get

func (a MockAesStore) Get(name string) Key

func (MockAesStore) GetOrNew

func (a MockAesStore) GetOrNew(name string) (Key, bool)

func (MockAesStore) New

func (a MockAesStore) New(name string) Key

func (MockAesStore) Revive

func (a MockAesStore) Revive(name string)

func (MockAesStore) Stop

func (a MockAesStore) Stop()

func (MockAesStore) Store

func (a MockAesStore) Store(name string, key []byte)

type Store

type Store interface {
	New(name string) Key
	Get(name string) Key
	GetOrNew(name string) (Key, bool)
	Store(name string, key []byte)
	Revive(name string)
	Stop()
}

func New

func New() Store

Jump to

Keyboard shortcuts

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