* Add argon2 credentials * Verify oplog in tests * Refactor: rename field * Update internal/auth/password/repository_account.go Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com> * Add inline comments to SQL query to doc mapping to structure * Refactor: move authentication query to query.go file * Replace immutable_create_time_func with immutable_columns Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
30 lines
666 B
Go
30 lines
666 B
Go
package password
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/watchtower/internal/db"
|
|
)
|
|
|
|
// Prefixes for private ids for types in the password package.
|
|
const (
|
|
argon2ConfigurationPrefix = "arg2conf"
|
|
argon2CredentialPrefix = "arg2cred"
|
|
)
|
|
|
|
func newArgon2ConfigurationId() (string, error) {
|
|
id, err := db.NewPrivateId(argon2ConfigurationPrefix)
|
|
if err != nil {
|
|
return "", fmt.Errorf("new password argon2 configuration id: %w", err)
|
|
}
|
|
return id, err
|
|
}
|
|
|
|
func newArgon2CredentialId() (string, error) {
|
|
id, err := db.NewPrivateId(argon2CredentialPrefix)
|
|
if err != nil {
|
|
return "", fmt.Errorf("new password argon2 configuration id: %w", err)
|
|
}
|
|
return id, err
|
|
}
|