aboutsummaryrefslogtreecommitdiff
path: root/src/user/secret.go
diff options
context:
space:
mode:
authorAlexander Kavon <me+git@alexkavon.com>2024-01-22 18:17:09 -0500
committerAlexander Kavon <me+git@alexkavon.com>2024-01-22 18:17:09 -0500
commit0d7693918d53fd658231bc478654b32513feac7a (patch)
treeec84b7bf026f8fefe947663e364d1120f513cf88 /src/user/secret.go
parent66d84b2b49f55e6c652816466a5c3b4202234134 (diff)
only return error for compareSecretToHash, update login form
Diffstat (limited to 'src/user/secret.go')
-rw-r--r--src/user/secret.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/user/secret.go b/src/user/secret.go
index a777072..5efe658 100644
--- a/src/user/secret.go
+++ b/src/user/secret.go
@@ -55,11 +55,11 @@ func hashSecret(secret string) (string, error) {
return encodedHash, nil
}
-func compareSecretToHash(secret, encoded string) (bool, error) {
+func compareSecretToHash(secret, encoded string) error {
// decode the encoded hash
hc, salt, comparehash, err := decodeHash(encoded)
if err != nil {
- return false, err
+ return err
}
// encode the secret
@@ -68,10 +68,10 @@ func compareSecretToHash(secret, encoded string) (bool, error) {
// compare the hashes using constant time comparison
// to prevent timing attacks. if not equal, then return false
if subtle.ConstantTimeCompare(comparehash, verifyhash) != 1 {
- return false, errHashesNotEqual
+ return errHashesNotEqual
}
- return true, nil
+ return nil
}
func hashArgon2(secret string, salt []byte, hc *hashconf) []byte {