state

package
v0.0.0-...-5dc20d2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(adminUsername string, adminPassword string) error

func UnwrapAccounts

func UnwrapAccounts(waccs []WrappedAccount) []apitypes.Account

func UnwrapSecrets

func UnwrapSecrets(secrets []WrappedSecret, st *AppState) []apitypes.ExposedSecret

Types

type AppState

type AppState struct {
	DB       *Statefile
	EventLog eventlog.Log

	S3ExportBucket string
	S3ExportApiKey string
	S3ExportSecret string
	// contains filtered or unexported fields
}

func New

func New(logger *log.Logger) *AppState

func NewTesting

func NewTesting() *AppState

func (*AppState) ApplyAccountCreated

func (s *AppState) ApplyAccountCreated(e *domain.AccountCreated) error

func (*AppState) ApplyAccountDeleted

func (s *AppState) ApplyAccountDeleted(e *domain.AccountDeleted) error

func (*AppState) ApplyAccountDescriptionChanged

func (s *AppState) ApplyAccountDescriptionChanged(e *domain.AccountDescriptionChanged) error

func (*AppState) ApplyAccountExternalTokenAdded

func (s *AppState) ApplyAccountExternalTokenAdded(e *domain.AccountExternalTokenAdded) error

func (*AppState) ApplyAccountFolderCreated

func (s *AppState) ApplyAccountFolderCreated(e *domain.AccountFolderCreated) error

func (*AppState) ApplyAccountFolderDeleted

func (s *AppState) ApplyAccountFolderDeleted(e *domain.AccountFolderDeleted) error

func (*AppState) ApplyAccountFolderMoved

func (s *AppState) ApplyAccountFolderMoved(e *domain.AccountFolderMoved) error

func (*AppState) ApplyAccountFolderRenamed

func (s *AppState) ApplyAccountFolderRenamed(e *domain.AccountFolderRenamed) error

func (*AppState) ApplyAccountKeylistAdded

func (s *AppState) ApplyAccountKeylistAdded(e *domain.AccountKeylistAdded) error

func (*AppState) ApplyAccountMoved

func (s *AppState) ApplyAccountMoved(e *domain.AccountMoved) error

func (*AppState) ApplyAccountOtpTokenAdded

func (s *AppState) ApplyAccountOtpTokenAdded(e *domain.AccountOtpTokenAdded) error

func (*AppState) ApplyAccountPasswordAdded

func (s *AppState) ApplyAccountPasswordAdded(e *domain.AccountPasswordAdded) error

func (*AppState) ApplyAccountRenamed

func (s *AppState) ApplyAccountRenamed(e *domain.AccountRenamed) error

func (*AppState) ApplyAccountSecretDeleted

func (s *AppState) ApplyAccountSecretDeleted(e *domain.AccountSecretDeleted) error

func (*AppState) ApplyAccountSecretNoteAdded

func (s *AppState) ApplyAccountSecretNoteAdded(e *domain.AccountSecretNoteAdded) error

func (*AppState) ApplyAccountSecretUsed

func (s *AppState) ApplyAccountSecretUsed(e *domain.AccountSecretUsed) error

func (*AppState) ApplyAccountSshKeyAdded

func (s *AppState) ApplyAccountSshKeyAdded(e *domain.AccountSshKeyAdded) error

func (*AppState) ApplyAccountUrlChanged

func (s *AppState) ApplyAccountUrlChanged(e *domain.AccountUrlChanged) error

func (*AppState) ApplyAccountUsernameChanged

func (s *AppState) ApplyAccountUsernameChanged(e *domain.AccountUsernameChanged) error

func (*AppState) ApplyDatabaseMasterPasswordChanged

func (s *AppState) ApplyDatabaseMasterPasswordChanged(e *domain.DatabaseMasterPasswordChanged) error

func (*AppState) ApplyDatabaseS3IntegrationConfigured

func (s *AppState) ApplyDatabaseS3IntegrationConfigured(e *domain.DatabaseS3IntegrationConfigured) error

func (*AppState) ApplyDatabaseUnsealed

func (s *AppState) ApplyDatabaseUnsealed(e *domain.DatabaseUnsealed) error

func (*AppState) ApplySessionSignedIn

func (s *AppState) ApplySessionSignedIn(e *domain.SessionSignedIn) error

func (*AppState) ApplyUserAccessTokenAdded

func (s *AppState) ApplyUserAccessTokenAdded(e *domain.UserAccessTokenAdded) error

func (*AppState) ApplyUserCreated

func (s *AppState) ApplyUserCreated(e *domain.UserCreated) error

func (*AppState) ApplyUserPasswordUpdated

func (s *AppState) ApplyUserPasswordUpdated(e *domain.UserPasswordUpdated) error

func (*AppState) ApplyUserU2FTokenRegistered

func (s *AppState) ApplyUserU2FTokenRegistered(e *domain.UserU2FTokenRegistered) error

func (*AppState) ApplyUserU2FTokenUsed

func (s *AppState) ApplyUserU2FTokenUsed(e *domain.UserU2FTokenUsed) error

func (*AppState) Close

func (s *AppState) Close()

func (*AppState) GetJwtSigningKey

func (s *AppState) GetJwtSigningKey() []byte

func (*AppState) GetJwtValidationKey

func (s *AppState) GetJwtValidationKey() []byte

func (*AppState) GetMacSigningKey

func (s *AppState) GetMacSigningKey() string

func (*AppState) GetMasterPassword

func (s *AppState) GetMasterPassword() string

for Keepass export

func (*AppState) HandleUnknownEvent

func (s *AppState) HandleUnknownEvent(e event.Event) error

func (*AppState) IsUnsealed

func (s *AppState) IsUnsealed() bool

func (*AppState) NextFreeUserId

func (s *AppState) NextFreeUserId() string

func (*AppState) SetMasterPassword

func (s *AppState) SetMasterPassword(password string)

func (*AppState) SetSealed

func (s *AppState) SetSealed(sealed bool)

type Config

type Config struct {
	JwtPrivateKey string `json:"jwt_private_key"`
	JwtPublicKey  string `json:"jwt_public_key"`
}

type SensitiveUser

type SensitiveUser struct {
	User         apitypes.User
	AccessToken  string // stores only the latest. TODO: support multiple
	PasswordHash string
}

type Statefile

type Statefile struct {
	UserScope map[string]*UserStorage // keyed by id
	AuditLog  []apitypes.AuditlogEntry
}

func NewStatefile

func NewStatefile() *Statefile

func (*Statefile) Audit

func (s *Statefile) Audit(message string, meta *event.EventMeta)

type U2FToken

type U2FToken struct {
	Name             string
	EnrolledAt       time.Time
	KeyHandle        string
	RegistrationData string
	ClientData       string
	Version          string
	Counter          uint32
}

type UserStorage

type UserStorage struct {
	SensitiveUser   SensitiveUser
	WrappedAccounts []WrappedAccount
	Folders         []apitypes.Folder
	U2FTokens       []*U2FToken
}

func NewUserStorage

func NewUserStorage(sensitiveUser SensitiveUser) *UserStorage

func (*UserStorage) FolderById

func (s *UserStorage) FolderById(id string) *apitypes.Folder

func (*UserStorage) SubfoldersByParentId

func (s *UserStorage) SubfoldersByParentId(id string) []apitypes.Folder

func (*UserStorage) WrappedAccountById

func (s *UserStorage) WrappedAccountById(id string) *WrappedAccount

func (*UserStorage) WrappedAccountsByFolder

func (s *UserStorage) WrappedAccountsByFolder(id string) []WrappedAccount

func (*UserStorage) WrappedSecretById

func (s *UserStorage) WrappedSecretById(accountId string, secretId string) *WrappedSecret

type WrappedAccount

type WrappedAccount struct {
	Account apitypes.Account
	Secrets []WrappedSecret
}

FIXME: this has the same name as with apitypes.WrappedAccount

type WrappedSecret

type WrappedSecret struct {
	Secret             apitypes.Secret
	SshPrivateKey      string
	OtpProvisioningUrl string
	KeylistKeys        []apitypes.SecretKeylistKey
}

Jump to

Keyboard shortcuts

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