Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAccessToken

func GenerateAccessToken() string

Total: (SHA-256 of nano secs = 256 bits) + (32 random bytes) = 64 bytes

func GenerateOTPCode

func GenerateOTPCode(length int) int

func GeneratePassword

func GeneratePassword(length int) string

Generate a random password with a specific length. It returns an empty string if there is any error.

func GetFirebaseUser

func GetFirebaseUser(accessToken string) (*firebase.UserRecord, error)

func GetSHA256

func GetSHA256(value string) string

Returns SHA256 of a string

func HasPermission

func HasPermission(c echo.Context, subject string) bool

HasPermission return true if a subject has permission on a request

func InitCasbin

func InitCasbin(config CasbinConfig) error

InitCasbin creates an enforcer via file. See `casbin.NewEnforcer` for more info.

Types

type CasbinConfig

type CasbinConfig struct {
	Model  string `yaml:"model"`
	Policy string `yaml:"policy"`
}