2019-11-15 04:58:55 +00:00
|
|
|
package constants
|
|
|
|
|
2022-12-06 05:07:52 +00:00
|
|
|
import "time"
|
|
|
|
|
2019-11-15 04:58:55 +00:00
|
|
|
// Misc constants.
|
|
|
|
const (
|
|
|
|
// Password values
|
|
|
|
PasswordMinLength = 8
|
|
|
|
BcryptCost = 14
|
2022-12-06 05:07:52 +00:00
|
|
|
|
|
|
|
// Rate limits
|
|
|
|
RateLimitRedisKey = "rate-limit/%s/%s" // namespace, id
|
|
|
|
LoginRateLimitWindow = 1 * time.Hour
|
|
|
|
LoginRateLimit = 10 // 10 failed login attempts = locked for full hour
|
|
|
|
LoginRateLimitCooldownAt = 3 // 3 failed attempts = start throttling
|
|
|
|
LoginRateLimitCooldown = 30 * time.Second
|
2019-11-15 04:58:55 +00:00
|
|
|
)
|