2020-07-24 10:23:35 -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-24 10:23:35 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// PublicId prefixes for the resources in the password package.
|
|
|
|
|
const (
|
2020-08-25 00:21:08 -04:00
|
|
|
AuthMethodPrefix = "ampw"
|
|
|
|
|
AccountPrefix = "apw"
|
2020-07-24 10:23:35 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func newAuthMethodId() (string, error) {
|
2021-02-11 13:32:45 -06:00
|
|
|
const op = "password.newAuthMethodId"
|
2020-07-24 10:23:35 -04:00
|
|
|
id, err := db.NewPublicId(AuthMethodPrefix)
|
|
|
|
|
if err != nil {
|
2021-02-11 13:32:45 -06:00
|
|
|
return "", errors.Wrap(err, op)
|
2020-07-24 10:23:35 -04:00
|
|
|
}
|
2021-03-05 06:34:06 -08:00
|
|
|
return id, nil
|
2020-07-24 10:23:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newAccountId() (string, error) {
|
2021-02-11 13:32:45 -06:00
|
|
|
const op = "password.newAccountId"
|
2020-07-24 10:23:35 -04:00
|
|
|
id, err := db.NewPublicId(AccountPrefix)
|
|
|
|
|
if err != nil {
|
2021-02-11 13:32:45 -06:00
|
|
|
return "", errors.Wrap(err, op)
|
2020-07-24 10:23:35 -04:00
|
|
|
}
|
2021-03-05 06:34:06 -08:00
|
|
|
return id, nil
|
2020-07-24 10:23:35 -04:00
|
|
|
}
|