aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/auth/password.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/auth/password.go')
-rw-r--r--backend/auth/password.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/backend/auth/password.go b/backend/auth/password.go
new file mode 100644
index 0000000..2bb3490
--- /dev/null
+++ b/backend/auth/password.go
@@ -0,0 +1,9 @@
+package auth
+
+import "golang.org/x/crypto/bcrypt"
+
+// VerifyPassword checks if the provided password matches the hashed password
+func VerifyPassword(hashedPassword, password string) bool {
+ err := bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte(password))
+ return err == nil
+}