Documentation
¶
Overview ¶
Package misc provides miscellaneous structs and methods used by the application.
Index ¶
- Variables
- func CalculateMessageHMACSHA256(message string, secret string) string
- func CreateAPIClient(account *models.Account) *eveapi.API
- func DecryptAndAuthenticate(encodedCipherText, secret string) (string, error)
- func EncryptAndAuthenticate(message, secret string) (string, error)
- func GenerateRandomString(length int) string
- func SetupLogger(debugLevel int)
- func VerifyMessageHMACSHA256(message string, calculated string, secret string) bool
- type AuthStatus
- type Configuration
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCipherText describes invalid ciphertext ErrInvalidCipherText = errors.New("Invalid CipherText") )
var ( // Logger is a accessible logger, providing formatted log messages with different output levels Logger *factorlog.FactorLog )
Functions ¶
func CalculateMessageHMACSHA256 ¶
CalculateMessageHMACSHA256 calculates the HMAC of a message using the SHA256 algorithm and the given secret
func CreateAPIClient ¶
CreateAPIClient creates an EVE Online API client used for querying API data
func DecryptAndAuthenticate ¶
DecryptAndAuthenticate decrypts and authenticates a message using AES-GCM
func EncryptAndAuthenticate ¶
EncryptAndAuthenticate encrypts and authenticates a message using AES-GCM
func GenerateRandomString ¶
GenerateRandomString returns a random alphanumerical string with the given length
func SetupLogger ¶
func SetupLogger(debugLevel int)
SetupLogger configures the logger, setting a custom format and output level
Types ¶
type AuthStatus ¶
type AuthStatus int
AuthStatus represents the result of an authentication attempt by the user
const ( // AuthStatusUnknown indicates an unknown status during the authentication AuthStatusUnknown AuthStatus = iota // AuthStatusError indicates an (internal) error during the authentication AuthStatusError // AuthStatusCredentialMismatch indicates a mismatch of the given passwords and stored bcrypt hash AuthStatusCredentialMismatch // AuthStatusUnverifiedEmail indicates the user's email address has not been verified yet AuthStatusUnverifiedEmail // AuthStatusSuccess indicates a successful authentication attempt AuthStatusSuccess )
func (AuthStatus) String ¶
func (authStatus AuthStatus) String() string
String returns an easily readable (string) representation of the AuthStatus
type Configuration ¶
type Configuration struct { // DatabaseType represents the database type to be used as a backend DatabaseType int // DatabaseHost represents the hostname:port of the database backend DatabaseHost string // DatabaseSchema represents the schema/collection of the database backend DatabaseSchema string // DatabaseUser represents the username used to authenticate with the database backend DatabaseUser string // DatabasePassword represents the password used to authenticate with the database backend DatabasePassword string // RedisHost represents the hostname:port of the Redis data store RedisHost string // RedisPassword represents the password used to authenticate with the Redis data store RedisPassword string // RedisDB represents the database to select for the session store RedisDB string // SMTPHost represents the hostname:port of the SMTP server used for sending mails SMTPHost string // SMTPStartTLS indicates whether the SMTP connection should use the StartTLS command to secure communications SMTPStartTLS bool // SMTPUser represents the username used to authenticate with the SMTP server SMTPUser string // SMTPPassword represents the password used to authenticate with the SMTP server SMTPPassword string // SMTPSender represents the email address set as the sender of all outgoing emails SMTPSender string // DebugLevel represents the debug level for log messages DebugLevel int // DebugTemplates toggles the reloading of all templates for every request DebugTemplates bool // HTTPHost represents the hostname:port the application should listen to for requests HTTPHost string // HTTPPublicURL represents the public URL the eveauth app is reachable at HTTPPublicURL string }
Configuration stores all configuration values required by the application
func LoadConfig ¶
func LoadConfig() (*Configuration, error)
LoadConfig creates a Configuration by either using commandline flags or a configuration file, returning an error if the parsing failed
func ParseCommandlineFlags ¶
func ParseCommandlineFlags(config *Configuration) *Configuration
ParseCommandlineFlags parses the command line flags used with the application
func ParseJSONConfig ¶
func ParseJSONConfig(path string) (*Configuration, error)
ParseJSONConfig parses a Configuration from a JSON encoded file, returning an error if the process failed