Documentation ¶
Index ¶
- func AppConfig(c *gin.Context) *config.AppConfig
- func Engine(c *gin.Context) engine.ClientInterface
- func Logger(c *gin.Context) *zerolog.Logger
- func SetAppConfig(c *gin.Context, appConfig *config.AppConfig)
- func SetEngine(c *gin.Context, engine engine.ClientInterface)
- func SetLogger(c *gin.Context, logger *zerolog.Logger)
- func SetUserContext(c *gin.Context, userContext *UserContext)
- type AdminContext
- type AuthType
- type UserContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Engine ¶
func Engine(c *gin.Context) engine.ClientInterface
Engine returns the app engine from the request context
func SetAppConfig ¶
SetAppConfig sets the app config in the request context
func SetEngine ¶
func SetEngine(c *gin.Context, engine engine.ClientInterface)
SetEngine sets the app engine in the request context
func SetUserContext ¶
func SetUserContext(c *gin.Context, userContext *UserContext)
SetUserContext sets the user context in the request context
Types ¶
type AdminContext ¶
type AdminContext struct {
// contains filtered or unexported fields
}
AdminContext doesn't store any significant information but help to distinguish Admin from User endpoints
func NewAdminContext ¶
func NewAdminContext() *AdminContext
NewAdminContext creates a new AdminContext
type UserContext ¶
type UserContext struct { AuthType AuthType // contains filtered or unexported fields }
UserContext is the context for the user
func GetUserContext ¶
func GetUserContext(c *gin.Context) *UserContext
GetUserContext returns the user context from the request context
func NewUserContextAsAdmin ¶
func NewUserContextAsAdmin() *UserContext
NewUserContextAsAdmin creates a new UserContext as an admin
func NewUserContextWithAccessKey ¶
func NewUserContextWithAccessKey(xpubID string, xPubObj *engine.Xpub) *UserContext
NewUserContextWithAccessKey creates a new UserContext based on accessKey authorization
func NewUserContextWithXPub ¶
func NewUserContextWithXPub(xpub, xpubID string, xPubObj *engine.Xpub) *UserContext
NewUserContextWithXPub creates a new UserContext based on xpub authorization
func (*UserContext) GetAuthType ¶
func (ctx *UserContext) GetAuthType() AuthType
GetAuthType returns the authentication type from the user context
func (*UserContext) GetXPubID ¶
func (ctx *UserContext) GetXPubID() string
GetXPubID returns the xPubID from the user context
func (*UserContext) GetXPubObj ¶
func (ctx *UserContext) GetXPubObj() *engine.Xpub
GetXPubObj returns an object of engine.Xpub
func (*UserContext) ShouldGetXPub ¶
func (ctx *UserContext) ShouldGetXPub() (string, error)
ShouldGetXPub returns the xPub from the user context If the authentication type is not xPub, it will return an error