Documentation ¶
Index ¶
- type ArgonParams
- type Utils
- func (u *Utils) CreateArgonHash(plainTextPW string) string
- func (u *Utils) DecodeHash(encodedHash string) (p *ArgonParams, salt, hash []byte, err error)
- func (u *Utils) ErrorJSON(w http.ResponseWriter, r *http.Request, envelope string, data interface{}, ...) error
- func (u *Utils) GenerateActivationToken() (string, error)
- func (u *Utils) GenerateRandomBytes(saltLength uint32) ([]byte, error)
- func (u *Utils) IsRequired(s interface{}, key string) bool
- func (u *Utils) ValidatePhoneNumber(s string) bool
- func (u *Utils) VerifyArgonHash(plaintextPW string, previousHash string) bool
- func (u *Utils) WriteJSON(w http.ResponseWriter, r *http.Request, envelope string, data interface{}, ...) error
- type Utilser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgonParams ¶
type Utils ¶
type Utils struct { ArgonParams // contains filtered or unexported fields }
func NewUtils ¶
NewUtils is a utility helper to take care of certain tasks It needs the app config passed into it so it can have access to app wide items
func (*Utils) CreateArgonHash ¶
func (*Utils) DecodeHash ¶
func (u *Utils) DecodeHash(encodedHash string) (p *ArgonParams, salt, hash []byte, err error)
func (*Utils) GenerateActivationToken ¶
func (*Utils) GenerateRandomBytes ¶
func (*Utils) IsRequired ¶
func (*Utils) ValidatePhoneNumber ¶
ValidatePhoneNumber takes in a phone number as a text string, and runs a regex match on it and returns the result as a bool
func (*Utils) VerifyArgonHash ¶
func (*Utils) WriteJSON ¶
func (u *Utils) WriteJSON(w http.ResponseWriter, r *http.Request, envelope string, data interface{}, statusCode int, headers ...http.Header) error
WriteJSON takes in a responseWriter, request, enveolor, and data and write json to the response writer. it can return a potential error to pass in headers use headers := make(http.Header)
type Utilser ¶
type Utilser interface { ValidatePhoneNumber(string) bool WriteJSON(w http.ResponseWriter, r *http.Request, envelope string, data interface{}) error ErrorJSON(w http.ResponseWriter, r *http.Request, enveloper string, data interface{}, statusCode int, headers ...http.Header) error CreateArgonHash(string, []byte) string GenerateRandomBytes(uint32) ([]byte, error) VerifyArgonHash(string, []byte) bool GenerateActivationToken() (string, error) }
Click to show internal directories.
Click to hide internal directories.