refactor(server): relocate user.getPasswordHashAlgorithm (#4101)

Trivial code movement, no effective code changes.
This commit is contained in:
Julio López authored and GitHub committed 2024-09-09 17:00:07 -07:00
1 parent 72dcd65fb6
commit bdbdd404d9
2 files changed
+15 -14

No files matched your search

-14
View File
@@ -1,18 +1,4 @@
package user
import "github.com/pkg/errors"
// defaultPasswordHashVersion is the default scheme used for user password hashing.
const defaultPasswordHashVersion = ScryptHashVersion
// getPasswordHashAlgorithm returns the password hash algorithm given a version.
func getPasswordHashAlgorithm(passwordHashVersion int) (string, error) {
switch passwordHashVersion {
case ScryptHashVersion:
return scryptHashAlgorithm, nil
case Pbkdf2HashVersion:
return pbkdf2HashAlgorithm, nil
default:
return "", errors.Errorf("unsupported hash version (%d)", passwordHashVersion)
}
}
+15
View File
@@ -0,0 +1,15 @@
package user
import "github.com/pkg/errors"
// getPasswordHashAlgorithm returns the password hash algorithm given a version.
func getPasswordHashAlgorithm(passwordHashVersion int) (string, error) {
switch passwordHashVersion {
case ScryptHashVersion:
return scryptHashAlgorithm, nil
case Pbkdf2HashVersion:
return pbkdf2HashAlgorithm, nil
default:
return "", errors.Errorf("unsupported hash version (%d)", passwordHashVersion)
}
}