state

package
v0.0.0-...-de0f673 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecryptionKeyLocked = errors.New("decryption key locked")
)

Functions

func ExportPrivateKeyWithPassword

func ExportPrivateKeyWithPassword(
	privKey *rsa.PrivateKey,
	password string,
	meta ehevent.EventMeta,
) (*domain.UserDecryptionKeyPasswordChanged, error)

func InitConfig

func InitConfig(adminUsername string, adminPassword string) error

func RandomId

func RandomId() string

func UnwrapAccounts

func UnwrapAccounts(iaccounts []InternalAccount) []apitypes.Account

Types

type AppState

type AppState struct {
	EventLog eventlog.Log // FIXME: outdated (non-stream-aware) interface
	// contains filtered or unexported fields
}

func New

func New(logger *log.Logger) (*AppState, error)

func (*AppState) FindUserByUsername

func (a *AppState) FindUserByUsername(username string) *UserStorage

func (*AppState) User

func (a *AppState) User(id string) *UserStorage

func (*AppState) UserIds

func (a *AppState) UserIds() []string

lists user known user IDs

func (*AppState) ValidatedJwtConf

func (a *AppState) ValidatedJwtConf() *JwtConfig

type InternalAccount

type InternalAccount struct {
	Account apitypes.Account // exposed to UI - the rest are not
	Secrets []InternalSecret
}

type InternalSecret

type InternalSecret struct {
	Id string

	Title                  string
	SshPublicKeyAuthorized string

	Kind     domain.SecretKind
	Envelope []byte // depending on Kind: password | secret note | OTP provisioning URL | SSH key
	// contains filtered or unexported fields
}

type JwtConfig

type JwtConfig struct {
	SigningKey       string `json:"jwt_private_key"`
	AuthenticatorKey string `json:"jwt_public_key"`
}

type S3ExportDetails

type S3ExportDetails struct {
	Bucket       string
	ApiKeyId     string
	ApiKeySecret string
}

type SensitiveUser

type SensitiveUser struct {
	User         apitypes.User // exposed to UI - the rest are not
	AccessToken  string        // stores only the latest. TODO: support multiple
	PasswordHash string
}

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 {
	// contains filtered or unexported fields
}

holds all state for one user

func (*UserStorage) AuditLog

func (s *UserStorage) AuditLog() []apitypes.AuditlogEntry

func (*UserStorage) Crypto

func (s *UserStorage) Crypto() *cryptoThingie

func (*UserStorage) DecryptKeylist

func (s *UserStorage) DecryptKeylist(secret InternalSecret) ([]domain.AccountKeylistAddedKeysItem, error)

func (*UserStorage) DecryptOtpProvisioningUrl

func (s *UserStorage) DecryptOtpProvisioningUrl(secret InternalSecret) (string, error)

func (*UserStorage) DecryptSecrets

func (s *UserStorage) DecryptSecrets(
	secrets []InternalSecret,
) ([]apitypes.ExposedSecret, error)

func (*UserStorage) FolderById

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

func (*UserStorage) GetEventTypes

func (l *UserStorage) GetEventTypes() ehevent.Allocators

func (*UserStorage) InternalSecretById

func (s *UserStorage) InternalSecretById(accountId string, secretId string) *InternalSecret

func (*UserStorage) OtpKeyExportMac

func (s *UserStorage) OtpKeyExportMac(secret *InternalSecret) *mac.Mac

func (*UserStorage) ProcessEvents

func (l *UserStorage) ProcessEvents(ctx context.Context, handle ehreader.EventProcessorHandler) error

func (*UserStorage) S3ExportDetails

func (s *UserStorage) S3ExportDetails() *S3ExportDetails

func (*UserStorage) SearchAccounts

func (s *UserStorage) SearchAccounts(query string) []apitypes.Account

func (*UserStorage) SearchFolders

func (s *UserStorage) SearchFolders(query string) []apitypes.Folder

func (*UserStorage) SensitiveUser

func (s *UserStorage) SensitiveUser() SensitiveUser

func (*UserStorage) SignInGetU2fChallengeMac

func (s *UserStorage) SignInGetU2fChallengeMac() *mac.Mac

func (*UserStorage) SubfoldersByParentId

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

func (*UserStorage) U2FTokens

func (s *UserStorage) U2FTokens() []*U2FToken

func (*UserStorage) UserId

func (s *UserStorage) UserId() string

func (*UserStorage) WrappedAccountById

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

func (*UserStorage) WrappedAccounts

func (s *UserStorage) WrappedAccounts() []InternalAccount

func (*UserStorage) WrappedAccountsByFolder

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

Jump to

Keyboard shortcuts

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