Documentation ¶
Index ¶
- Constants
- Variables
- func BadRequest(w http.ResponseWriter, data interface{})
- func ComparePasswordAndHash(password, encodedHash string) (match bool, err error)
- func HashPasswd(password string, p *ArgonParams) (encodedHash string, err error)
- func InternalServerError(w http.ResponseWriter, data interface{})
- func NotFound(w http.ResponseWriter, data interface{})
- func OK(w http.ResponseWriter, data interface{})
- func Send(w http.ResponseWriter, status int, data interface{})
- func Unauthorized(w http.ResponseWriter)
- type ArgonParams
- type GenericResult
Constants ¶
View Source
const (
ErrorBadRequestBody = "Bad Request body. Make sure it is properly formatted json"
)
Variables ¶
View Source
var ( ErrInvalidHash = errors.New("the encoded hash is not in the correct format") ErrIncompatibleVersion = errors.New("incompatible version of argon2") )
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, data interface{})
func ComparePasswordAndHash ¶
func HashPasswd ¶
func HashPasswd(password string, p *ArgonParams) (encodedHash string, err error)
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, data interface{})
func NotFound ¶
func NotFound(w http.ResponseWriter, data interface{})
func OK ¶
func OK(w http.ResponseWriter, data interface{})
func Send ¶
func Send(w http.ResponseWriter, status int, data interface{})
func Unauthorized ¶
func Unauthorized(w http.ResponseWriter)
Types ¶
type ArgonParams ¶
type ArgonParams struct { Memory uint32 Iterations uint32 Parallelism uint8 SaltLength uint32 KeyLength uint32 }
var DefaultArgonParams ArgonParams = ArgonParams{
Memory: 64 * 1024,
Iterations: 3,
Parallelism: 2,
SaltLength: 16,
KeyLength: 32,
}
Default params for argon2id password hashing. These parameters are not audited and hence you should choose strong enough parameters for your usecase.
func DecodeHash ¶
func DecodeHash(encodedHash string) (p *ArgonParams, salt, hash []byte, err error)
type GenericResult ¶
type GenericResult struct { Success bool `json:"success"` Data interface{} `json:"data"` }
Click to show internal directories.
Click to hide internal directories.