Make hashing parameters configurable

This commit is contained in:
eikendev 2020-07-31 19:58:06 +02:00
parent c0ac5c3d16
commit ba0306f384
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
8 changed files with 86 additions and 37 deletions

View file

@ -4,6 +4,20 @@ import (
"github.com/jinzhu/configor"
)
// Argon2Config holds the parameters used for creating hashes with Argon2.
type Argon2Config struct {
Memory uint32 `default:"65536"`
Iterations uint32 `default:"1"`
Parallelism uint8 `default:"2"`
SaltLength uint32 `default:"16"`
KeyLength uint32 `default:"32"`
}
// CryptoConfig holds the parameters used for creating hashes.
type CryptoConfig struct {
Argon2 Argon2Config
}
// Configuration holds values that can be configured by the user.
type Configuration struct {
Database struct {
@ -20,6 +34,7 @@ type Configuration struct {
Username string `required:"true"`
Password string `required:"true"`
}
Crypto CryptoConfig
}
func configFiles() []string {