Documentation
¶
Index ¶
- Variables
- func ServeHTTP(settings *config.Schema) (err error)
- type APIAccount
- type APIEvent
- type APIMachineConfig
- type APIReply
- type APIStatus
- type User
- type UserCredentials
- type UsersDB
- func (db *UsersDB) DropToken(token string)
- func (db *UsersDB) GetEmailFromToken(token string) (email string, err error)
- func (db *UsersDB) IsAuthorized(email, pass string) (token string, err error)
- func (db *UsersDB) IsTokenAuthorized(token string) (email string, err error)
- func (db *UsersDB) RegisterUser(email, pass string) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrorDuplicatedUser = errors.New("duplicated user") ErrorEmptyEmailOrPwd = errors.New("username and password should not be empty") ErrorTokenNotFound = errors.New("token not found") )
error definitions
Functions ¶
Types ¶
type APIAccount ¶
type APIAccount struct {
Name string `json:"name"`
Address string `json:"address"`
GenesisBalance string `json:"genesis_balance"`
Validator bool `json:"validator"`
Faucet bool `json:"faucet"`
}
APIAccount API safe account object
type APIEvent ¶
type APIEvent struct {
ID string `json:"id"`
TokenSymbol string `json:"token_symbol"` // token symbool
Owner string `json:"owner"` // email address of the owner
Accounts map[string]APIAccount `json:"accounts"`
Provider string `json:"provider"` // provider for provisioning
CreatedOn time.Time `json:"created_on"`
StartsOn time.Time `json:"starts_on"`
EndsOn time.Time `json:"ends_on"`
State map[string]APIMachineConfig `json:"state"`
}
APIEvent API safe event object
func ToAPIEvent ¶
ToAPIEvent convert and Event to an APIEvent that is safe to publish via REST API Endpoints
func ToAPIEvents ¶
ToAPIEvents copy a list of events to a API save version
type APIMachineConfig ¶
type APIMachineConfig struct {
TendermintNodeID string `json:"tendermint_node_id"`
IPAddress string `json:"IPAddress"`
MachineName string `json:"MachineName"`
}
APIMachineConfig API safe machine config
type APIStatus ¶
type APIStatus struct {
Status string `json:"status,omitempty"`
Version string `json:"version,omitempty"`
Uptime string `json:"uptime,omitempty"`
}
APIStatus hold the status of the API
type UserCredentials ¶
type UserCredentials struct {
Email string `json:"email,omitempty"`
Pass string `json:"pass,omitempty"`
}
UserCredentials the input user credential for authentication
type UsersDB ¶
UsersDB keep the users database
func (*UsersDB) GetEmailFromToken ¶
GetEmailFromToken retrieve the email associated to a token
func (*UsersDB) IsAuthorized ¶
IsAuthorized verify if a use is authorized, if so, register a user token and returns it
func (*UsersDB) IsTokenAuthorized ¶
IsTokenAuthorized check whenever the token exists and returns the associated email otherwise returns error
func (*UsersDB) RegisterUser ¶
RegisterUser register a new user into the user database