http

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(a Auth, g Guard, l logging.Logger, webAppURL string, allowedOrigins []string) (http.Handler, error)

Types

type Auth

type Auth interface {
	errors.ToHTTPResponser

	RegisterFirst(loginType, userType, id string, secret []byte) (*model.User, error)
	CanRegisterFirst() (bool, error)
	RegisterSelf(loginType, userType, id string, secret []byte) (*model.User, error)
	RegisterSelfByLockedDevice(loginType, userType, devID, number string, password []byte) (*model.User, error)
	RegisterOther(JWT, newLoginType, userType, id, groupID string) (*model.User, error)

	UpdateIdentifier(JWT, forUserID, loginType, newId string) (*model.User, error)

	UpdatePassword(JWT string, old, newPass []byte) error
	SetPassword(loginType, onAddr string, dbt, pass []byte) (*model.VerifLogin, error)

	SendVerCode(JWT, loginType, toAddr string) (*model.DBTStatus, error)
	SendPassResetCode(loginType, toAddr string) (*model.DBTStatus, error)

	VerifyAndExtendDBT(lt, forAddr string, dbt []byte) (string, error)
	VerifyDBT(loginType, forAddr string, dbt []byte) (*model.VerifLogin, error)

	Login(loginType, identifier string, password []byte) (*model.User, error)

	Users(JWT string, q model.UsersQuery, offset, count string) ([]model.User, error)
	GetUserDetails(JWT, userID string) (*model.User, error)
	UserID(loginType, identifier string) (string, error)
	SetUserGroup(JWT, userID, groupID string) (*model.User, error)

	Groups(JWT, offset, count string) ([]model.Group, error)
}

type DBTStatus

type DBTStatus struct {
	ObfuscatedAddress string `json:"obfuscatedAddress,omitempty"`
	ExpiresAt         string `json:"expiresAt,omitempty"`
}

*

  • @api {NULL} OTPStatus OTP Status
  • @apiName OTPStatus
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiUse OTPStatus

func NewDBTStatus

func NewDBTStatus(dbtS *model.DBTStatus) *DBTStatus

type Device

type Device struct {
	ID         string `json:"ID,omitempty"`
	UserID     string `json:"userID,omitempty"`
	DeviceID   string `json:"deviceID,omitempty"`
	CreateDate string `json:"created,omitempty"`
	UpdateDate string `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} Device Device
  • @apiName Device
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiSuccess {String} ID Unique ID of the device (can be cast to long Integer).
  • @apiSuccess {String} userID ID for user who owns this device ID.
  • @apiSuccess {String} deviceID The unique device ID string value.
  • @apiSuccess {String} created ISO8601 date the device was created.
  • @apiSuccess {String} lastUpdated ISO8601 date the device was last updated.

func NewDevice

func NewDevice(g model.Device) *Device

func NewDevices

func NewDevices(ds []model.Device) []Device

type Facebook

type Facebook struct {
	ID         string `json:"ID,omitempty"`
	UserID     string `json:"userID,omitempty"`
	FacebookID string `json:"facebookID,omitempty"`
	Verified   bool   `json:"verified"`
	CreateDate string `json:"created,omitempty"`
	UpdateDate string `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} FacebookID FacebookID
  • @apiName FacebookID
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiSuccess {String} ID Unique ID of the facebook ID (can be cast to long Integer).
  • @apiSuccess {String} userID ID for user who owns this facebook ID.
  • @apiSuccess {String} facebookID The unique facebook ID string value.
  • @apiSuccess {Boolean} verified True if this login is verified, false otherwise.
  • @apiSuccess {String} created ISO8601 date the facebook ID was inserted.
  • @apiSuccess {String} lastUpdated ISO8601 date the facebook ID value was last updated.

func NewFacebook

func NewFacebook(fb model.Facebook) *Facebook

type Group

type Group struct {
	ID          string  `json:"ID,omitempty"`
	Name        string  `json:"name,omitempty"`
	AccessLevel float32 `json:"accessLevel,omitempty"`
	CreateDate  string  `json:"created,omitempty"`
	UpdateDate  string  `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} Group Group
  • @apiName Group
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiSuccess {String} ID Unique ID of the group (can be cast to long Integer).
  • @apiSuccess {String} name The unique group name string value.
  • @apiSuccess {Integer} accessLevel The access level for this group in (0 >= accessLevel <= 10)
  • @apiSuccess {String} created ISO8601 date the group was created.
  • @apiSuccess {String} lastUpdated ISO8601 date the group was last updated.

func NewGroup

func NewGroup(g model.Group) *Group

func NewGroups

func NewGroups(gs []model.Group) []Group

type Guard

type Guard interface {
	APIKeyValid(key string) (string, error)
}

type User

type User struct {
	ID         string      `json:"ID,omitempty"`
	JWT        string      `json:"JWT,omitempty"`
	Type       *UserType   `json:"type,omitempty"`
	UserName   *Username   `json:"username,omitempty"`
	Phone      *VerifLogin `json:"phone,omitempty"`
	Email      *VerifLogin `json:"email,omitempty"`
	Facebook   *Facebook   `json:"facebook,omitempty"`
	Group      *Group      `json:"group,omitempty"`
	Devices    []Device    `json:"devices,omitempty"`
	CreateDate string      `json:"created,omitempty"`
	UpdateDate string      `json:"lastUpdated,omitempty"`
}

*

  • @api {JSON} User User
  • @apiName User
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiUse User

func NewUser

func NewUser(user *model.User) *User

func NewUsers

func NewUsers(usrs []model.User) []User

type UserType

type UserType struct {
	ID         string `json:"ID,omitempty"`
	Name       string `json:"name,omitempty"`
	CreateDate string `json:"created,omitempty"`
	UpdateDate string `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} UserType User Type
  • @apiName UserType
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiSuccess {String} ID Unique ID of the userType (can be cast to long Integer).
  • @apiSuccess {String} name Unique name of the user type.
  • @apiSuccess {String} created ISO8601 date the user type was created.
  • @apiSuccess {String} lastUpdated ISO8601 date the user type was last updated.

func NewUserType

func NewUserType(ut model.UserType) *UserType

type Username

type Username struct {
	ID         string `json:"ID,omitempty"`
	UserID     string `json:"userID,omitempty"`
	Value      string `json:"value,omitempty"`
	CreateDate string `json:"created,omitempty"`
	UpdateDate string `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} Username Username
  • @apiName Username
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiSuccess {String} ID Unique ID of the username (can be cast to long Integer).
  • @apiSuccess {String} userID ID for user who owns this Username.
  • @apiSuccess {String} value The unique username string value.
  • @apiSuccess {String} created ISO8601 date the username was created.
  • @apiSuccess {String} lastUpdated ISO8601 date the username was last updated.

func NewUserName

func NewUserName(un model.Username) *Username

type VerifLogin

type VerifLogin struct {
	ID         string     `json:"ID,omitempty"`
	UserID     string     `json:"userID,omitempty"`
	Address    string     `json:"value,omitempty"`
	Verified   bool       `json:"verified"`
	OTPStatus  *DBTStatus `json:"OTPStatus,omitempty"`
	CreateDate string     `json:"created,omitempty"`
	UpdateDate string     `json:"lastUpdated,omitempty"`
}

*

  • @api {NULL} VerifLogin Verifiable Login
  • @apiName VerifLogin
  • @apiVersion 0.1.0
  • @apiGroup Objects *
  • @apiUse VerifLogin

func NewVerifLogin

func NewVerifLogin(vl *model.VerifLogin) *VerifLogin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL