2020-07-29 07:58:19 -04:00
|
|
|
package password
|
|
|
|
|
|
|
|
|
|
import (
|
2020-08-10 17:15:02 -04:00
|
|
|
"github.com/hashicorp/boundary/internal/db"
|
2021-02-11 13:32:45 -06:00
|
|
|
"github.com/hashicorp/boundary/internal/errors"
|
2020-07-29 07:58:19 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Prefixes for private ids for types in the password package.
|
|
|
|
|
const (
|
|
|
|
|
argon2ConfigurationPrefix = "arg2conf"
|
2020-07-31 11:18:41 -04:00
|
|
|
argon2CredentialPrefix = "arg2cred"
|
2020-07-29 07:58:19 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func newArgon2ConfigurationId() (string, error) {
|
2021-02-11 13:32:45 -06:00
|
|
|
const op = "password.newArgon2ConfigurationId"
|
2020-07-29 07:58:19 -04:00
|
|
|
id, err := db.NewPrivateId(argon2ConfigurationPrefix)
|
|
|
|
|
if err != nil {
|
2021-07-29 18:52:56 -06:00
|
|
|
return "", errors.WrapDeprecated(err, op)
|
2020-07-29 07:58:19 -04:00
|
|
|
}
|
2021-03-05 06:34:06 -08:00
|
|
|
return id, nil
|
2020-07-29 07:58:19 -04:00
|
|
|
}
|
2020-07-31 11:18:41 -04:00
|
|
|
|
|
|
|
|
func newArgon2CredentialId() (string, error) {
|
2021-02-11 13:32:45 -06:00
|
|
|
const op = "password.newArgon2CredentialId"
|
2020-07-31 11:18:41 -04:00
|
|
|
id, err := db.NewPrivateId(argon2CredentialPrefix)
|
|
|
|
|
if err != nil {
|
2021-07-29 18:52:56 -06:00
|
|
|
return "", errors.WrapDeprecated(err, op)
|
2020-07-31 11:18:41 -04:00
|
|
|
}
|
2021-03-05 06:34:06 -08:00
|
|
|
return id, nil
|
2020-07-31 11:18:41 -04:00
|
|
|
}
|