Documentation
¶
Index ¶
- Constants
- func DeserializeRequest(b []byte) (*http.Request, error)
- func DeserializeResponse(b []byte) (*http.Response, error)
- func GetEnv(key, fallback string) string
- func GetEnvBool(key string, fallback bool) bool
- func SerializeRequest(req *http.Request) ([]byte, error)
- func SerializeResponse(resp *http.Response) ([]byte, error)
- type LoginResponse
- type LoginUserParams
- type PasetoMaker
- type RegisterUserParams
- type TokenPayload
Constants ¶
View Source
const ( AuthHeaderKey = "Authorization" AuthHeaderBearerType = "bearer" )
Variables ¶
This section is empty.
Functions ¶
func GetEnvBool ¶
Types ¶
type LoginResponse ¶
type LoginUserParams ¶
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
func NewPaseto ¶
func NewPaseto(symmetricKey string) (*PasetoMaker, error)
func (*PasetoMaker) CreateToken ¶
func (*PasetoMaker) VerifyToken ¶
func (p *PasetoMaker) VerifyToken(token string) (*TokenPayload, error)
type RegisterUserParams ¶
type TokenPayload ¶
type TokenPayload struct { ID string `json:"id"` CreatedAt time.Time `json:"createdAt"` ExpiryAt time.Time `json:"expiryAt"` }
func NewPayload ¶
func NewPayload(id string, duration time.Duration) *TokenPayload
func (*TokenPayload) Valid ¶
func (p *TokenPayload) Valid() error
Click to show internal directories.
Click to hide internal directories.