feat(api tokens): properly hash tokens
This commit is contained in:
@ -1655,3 +1655,33 @@ func (err ErrLinkShareTokenInvalid) HTTPError() web.HTTPError {
|
||||
Message: "The provided link share token is invalid.",
|
||||
}
|
||||
}
|
||||
|
||||
// ================
|
||||
// API Token Errors
|
||||
// ================
|
||||
|
||||
// ErrAPITokenInvalid represents an error where an api token is invalid
|
||||
type ErrAPITokenInvalid struct {
|
||||
}
|
||||
|
||||
// IsErrAPITokenInvalid checks if an error is ErrAPITokenInvalid.
|
||||
func IsErrAPITokenInvalid(err error) bool {
|
||||
_, ok := err.(*ErrAPITokenInvalid)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err *ErrAPITokenInvalid) Error() string {
|
||||
return "Provided API token is invalid"
|
||||
}
|
||||
|
||||
// ErrCodeAPITokenInvalid holds the unique world-error code of this error
|
||||
const ErrCodeAPITokenInvalid = 14001
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrAPITokenInvalid) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{
|
||||
HTTPCode: http.StatusBadRequest,
|
||||
Code: ErrCodeAPITokenInvalid,
|
||||
Message: "The provided api token is invalid.",
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user