Move accountant into world

This commit is contained in:
Marc Di Luzio 2020-07-24 20:06:06 +01:00
parent 1e4d642038
commit e840b3e47b
6 changed files with 18 additions and 17 deletions

28
pkg/accounts/accounts.go Normal file
View file

@ -0,0 +1,28 @@
package accounts
// Accountant decribes something that stores accounts and account values
type Accountant interface {
// RegisterAccount will register a new account and return it's info
RegisterAccount(name string) (acc Account, err error)
// AssignData stores a custom account key value pair
AssignData(account string, key string, value string) error
// GetValue returns custom account data for a specific key
GetValue(account string, key string) (string, error)
// VerifySecret will verify whether the account secret matches with the
VerifySecret(account string, secret string) (bool, error)
// GetSecret gets the secret associated with an account
GetSecret(account string) (string, error)
}
// Account represents a registered user
type Account struct {
// Name simply describes the account and must be unique
Name string
// Data represents internal account data
Data map[string]string
}