helpers

package
v0.0.0-...-893b703 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hashedPassword, inputPassword string) bool

Login

func CheckToken

func CheckToken(token, role string) (bool, error)

lempar ke authValidate

func CloudUpload

func CloudUpload(src string) (string, error)

func HashPassword

func HashPassword(pass string) (string, error)

Register

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Role     string `json:"role"`
	jwt.RegisteredClaims
}

func EksportToken

func EksportToken(token string) (*Claims, error)

juga digunakan di authValidate

func NewToken

func NewToken(username, role string) *Claims

digunakan di service

func (*Claims) Create

func (c *Claims) Create() (string, error)

type Response

type Response struct {
	Code        int         `json:"-"`
	Status      string      `json:"status"`
	IsError     bool        `json:"isError"`
	Data        interface{} `json:"data,omitempty"`
	Description interface{} `json:"description,omitempty"`
}

func New

func New(data interface{}, code int, isError bool) *Response

func (*Response) Send

func (res *Response) Send(w http.ResponseWriter)

Jump to

Keyboard shortcuts

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