Documentation ¶
Index ¶
- Constants
- Variables
- func Validate(iv *InputValue) error
- type Aes256PassManager
- type Config
- type DbProvider
- type DbProviderFactory
- type DbStatus
- type InputValue
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) Delete(ctx context.Context, id int, user UserDataProvider) error
- func (m *Manager) GetOne(ctx context.Context, id int, user UserDataProvider) (StoredValue, bool, error)
- func (m *Manager) Init(ctx context.Context, pass string) error
- func (m *Manager) IsLocked() bool
- func (m *Manager) List(ctx context.Context, re *http.Request) ([]ValueKey, error)
- func (m *Manager) Lock(ctx context.Context) error
- func (m *Manager) Status(ctx context.Context) (StatusReport, error)
- func (m *Manager) Store(ctx context.Context, existingID int64, valueToStore *InputValue, ...) (StoredValueID, error)
- func (m *Manager) UnLock(ctx context.Context, pass string) error
- type NotInitDbProvider
- func (nidp *NotInitDbProvider) Close() error
- func (nidp *NotInitDbProvider) Delete(ctx context.Context, id int) error
- func (nidp *NotInitDbProvider) FindByKeyAndClientID(ctx context.Context, key, clientID string) (val StoredValue, found bool, err error)
- func (nidp *NotInitDbProvider) GetByID(ctx context.Context, id int) (val StoredValue, found bool, err error)
- func (nidp *NotInitDbProvider) GetStatus(ctx context.Context) (DbStatus, error)
- func (nidp *NotInitDbProvider) Init(ctx context.Context) error
- func (nidp *NotInitDbProvider) List(ctx context.Context, lo *query.ListOptions) ([]ValueKey, error)
- func (nidp *NotInitDbProvider) Save(ctx context.Context, user string, idToUpdate int64, val *InputValue, ...) (int64, error)
- func (nidp *NotInitDbProvider) SetStatus(ctx context.Context, newStatus DbStatus) error
- type PassManager
- type PassRequest
- type SqliteProvider
- func (p *SqliteProvider) Close() error
- func (p *SqliteProvider) Delete(ctx context.Context, id int) error
- func (p *SqliteProvider) FindByKeyAndClientID(ctx context.Context, key, clientID string) (val StoredValue, found bool, err error)
- func (p *SqliteProvider) GetByID(ctx context.Context, id int) (val StoredValue, found bool, err error)
- func (p *SqliteProvider) GetStatus(ctx context.Context) (DbStatus, error)
- func (p *SqliteProvider) List(ctx context.Context, lo *query.ListOptions) ([]ValueKey, error)
- func (p *SqliteProvider) Save(ctx context.Context, user string, idToUpdate int64, val *InputValue, ...) (int64, error)
- func (p *SqliteProvider) SetStatus(ctx context.Context, newStatus DbStatus) error
- type StatefulDbProviderFactory
- type StatusReport
- type StoredValue
- type StoredValueID
- type UserDataProvider
- type ValueKey
- type ValueType
Constants ¶
View Source
const ( DbStatusInit = "setup-completed" DbStatusNotInit = "uninitialized" StatusLocked = "locked" StatusUnlocked = "unlocked" )
Variables ¶
View Source
var DataSourceOptions = sqlite.DataSourceOptions{WALEnabled: false}
View Source
var ErrDatabaseNotInitialised = errors2.APIError{ Err: errors.New("vault is not initialized yet"), HTTPStatus: http.StatusConflict, }
View Source
var WrongPasswordError = errors2.APIError{ Message: "wrong password provided", HTTPStatus: http.StatusUnauthorized, }
Functions ¶
func Validate ¶
func Validate(iv *InputValue) error
Types ¶
type Aes256PassManager ¶
type Aes256PassManager struct { }
func (*Aes256PassManager) GetEncRandValue ¶
func (apm *Aes256PassManager) GetEncRandValue(pass string) (encValue, decValue string, err error)
GetEncRandValue generates a pseudo random hash sum and encrypts it with the provided password this is used to check if the provided password is correct and can potentially decrypt vault values
func (*Aes256PassManager) PassMatch ¶
func (apm *Aes256PassManager) PassMatch(dbStatus DbStatus, passToCheck string) (bool, error)
func (*Aes256PassManager) ValidatePass ¶
func (apm *Aes256PassManager) ValidatePass(passToCheck string) error
type DbProvider ¶
type DbProvider interface { GetStatus(ctx context.Context) (DbStatus, error) SetStatus(ctx context.Context, newStatus DbStatus) error GetByID(ctx context.Context, id int) (val StoredValue, found bool, err error) List(ctx context.Context, lo *query.ListOptions) ([]ValueKey, error) FindByKeyAndClientID(ctx context.Context, key, clientID string) (val StoredValue, found bool, err error) Save(ctx context.Context, user string, idToUpdate int64, val *InputValue, nowDate time.Time) (int64, error) Delete(ctx context.Context, id int) error io.Closer }
type DbProviderFactory ¶
type DbProviderFactory interface { GetDbProvider() DbProvider Init() error }
func NewStatefulDbProviderFactory ¶
func NewStatefulDbProviderFactory(initDBBuilder func() (DbProvider, error), notInitDBProvider DbProvider) DbProviderFactory
type InputValue ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(dbFactory DbProviderFactory, pm PassManager, logger *logger.Logger) *Manager
func (*Manager) GetOne ¶
func (m *Manager) GetOne(ctx context.Context, id int, user UserDataProvider) (StoredValue, bool, error)
func (*Manager) Store ¶
func (m *Manager) Store(ctx context.Context, existingID int64, valueToStore *InputValue, user UserDataProvider) (StoredValueID, error)
type NotInitDbProvider ¶
type NotInitDbProvider struct{}
func (*NotInitDbProvider) Close ¶
func (nidp *NotInitDbProvider) Close() error
func (*NotInitDbProvider) Delete ¶
func (nidp *NotInitDbProvider) Delete(ctx context.Context, id int) error
func (*NotInitDbProvider) FindByKeyAndClientID ¶
func (nidp *NotInitDbProvider) FindByKeyAndClientID(ctx context.Context, key, clientID string) (val StoredValue, found bool, err error)
func (*NotInitDbProvider) GetByID ¶
func (nidp *NotInitDbProvider) GetByID(ctx context.Context, id int) (val StoredValue, found bool, err error)
func (*NotInitDbProvider) GetStatus ¶
func (nidp *NotInitDbProvider) GetStatus(ctx context.Context) (DbStatus, error)
func (*NotInitDbProvider) List ¶
func (nidp *NotInitDbProvider) List(ctx context.Context, lo *query.ListOptions) ([]ValueKey, error)
type PassManager ¶
type PassRequest ¶
type PassRequest struct {
Password string `json:"password"`
}
type SqliteProvider ¶
type SqliteProvider struct {
// contains filtered or unexported fields
}
func NewSqliteProvider ¶
func NewSqliteProvider(c Config, logger *logger.Logger) (*SqliteProvider, error)
func (*SqliteProvider) Close ¶
func (p *SqliteProvider) Close() error
func (*SqliteProvider) FindByKeyAndClientID ¶
func (p *SqliteProvider) FindByKeyAndClientID(ctx context.Context, key, clientID string) (val StoredValue, found bool, err error)
func (*SqliteProvider) GetByID ¶
func (p *SqliteProvider) GetByID(ctx context.Context, id int) (val StoredValue, found bool, err error)
func (*SqliteProvider) GetStatus ¶
func (p *SqliteProvider) GetStatus(ctx context.Context) (DbStatus, error)
func (*SqliteProvider) List ¶
func (p *SqliteProvider) List(ctx context.Context, lo *query.ListOptions) ([]ValueKey, error)
type StatefulDbProviderFactory ¶
type StatefulDbProviderFactory struct {
// contains filtered or unexported fields
}
func (*StatefulDbProviderFactory) GetDbProvider ¶
func (dpf *StatefulDbProviderFactory) GetDbProvider() DbProvider
func (*StatefulDbProviderFactory) Init ¶
func (dpf *StatefulDbProviderFactory) Init() error
type StatusReport ¶
type StoredValue ¶
type StoredValueID ¶
type StoredValueID struct {
ID int64 `json:"id"`
}
type UserDataProvider ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.