mirror of
https://github.com/pushbits/server.git
synced 2025-05-29 08:46:38 +02:00
Restructure project layout
This commit is contained in:
parent
a49db216d5
commit
9a4a096526
32 changed files with 35 additions and 35 deletions
33
internal/authentication/credentials/credentials.go
Normal file
33
internal/authentication/credentials/credentials.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package credentials
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/pushbits/server/internal/configuration"
|
||||
|
||||
"github.com/alexedwards/argon2id"
|
||||
)
|
||||
|
||||
// Manager holds information for managing credentials.
|
||||
type Manager struct {
|
||||
checkHIBP bool
|
||||
argon2Params *argon2id.Params
|
||||
}
|
||||
|
||||
// CreateManager instanciates a credential manager.
|
||||
func CreateManager(checkHIBP bool, c configuration.CryptoConfig) *Manager {
|
||||
log.Println("Setting up credential manager.")
|
||||
|
||||
argon2Params := &argon2id.Params{
|
||||
Memory: c.Argon2.Memory,
|
||||
Iterations: c.Argon2.Iterations,
|
||||
Parallelism: c.Argon2.Parallelism,
|
||||
SaltLength: c.Argon2.SaltLength,
|
||||
KeyLength: c.Argon2.KeyLength,
|
||||
}
|
||||
|
||||
return &Manager{
|
||||
checkHIBP: checkHIBP,
|
||||
argon2Params: argon2Params,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue