From 7fd6e5912fb1694bce02b6aee57243737ce0dfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20L=C3=B3pez?= <1953782+julio-lopez@users.noreply.github.com> Date: Wed, 29 May 2024 18:02:14 -0700 Subject: [PATCH] chore(cli): cleanup user profile errors (#3889) --- internal/user/user_manager.go | 1 + internal/user/user_profile_pw_hash.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/user/user_manager.go b/internal/user/user_manager.go index b73625251..f1432017f 100644 --- a/internal/user/user_manager.go +++ b/internal/user/user_manager.go @@ -77,6 +77,7 @@ func ListUserProfiles(ctx context.Context, rep repo.Repository) ([]*Profile, err } // GetUserProfile returns the user profile with a given username. +// Returns ErrUserNotFound when the user does not exist. func GetUserProfile(ctx context.Context, r repo.Repository, username string) (*Profile, error) { manifests, err := r.FindManifests(ctx, map[string]string{ manifest.TypeLabelKey: ManifestType, diff --git a/internal/user/user_profile_pw_hash.go b/internal/user/user_profile_pw_hash.go index c01a8502f..d1c58e222 100644 --- a/internal/user/user_profile_pw_hash.go +++ b/internal/user/user_profile_pw_hash.go @@ -32,7 +32,7 @@ func (p *Profile) setPassword(password string) error { func computePasswordHash(password string, salt []byte, keyDerivationAlgorithm string) ([]byte, error) { key, err := crypto.DeriveKeyFromPassword(password, salt, passwordHashLength, keyDerivationAlgorithm) if err != nil { - return nil, errors.Wrap(err, "error deriving key from password") + return nil, errors.Wrap(err, "error hashing password") } payload := append(append([]byte(nil), salt...), key...)