mirror of
https://github.com/pushbits/server.git
synced 2025-06-09 22:22:01 +02:00
Make hashing parameters configurable
This commit is contained in:
parent
c0ac5c3d16
commit
ba0306f384
8 changed files with 86 additions and 37 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue