Skip to content

Conversation

@EleisonC
Copy link
Contributor

@EleisonC EleisonC commented Nov 13, 2025

Issue: #5 (comment)

This PR introduces a method, Password::from_password_hash, that safely wraps a cryptographically valid Argon2 PasswordHash into a Password instance. It ensures the User model correctly represents stored hashes without running validation meant for plaintext password input.

@EleisonC
Copy link
Contributor Author

Introduced a new type, HashPassword, that impl fn parse to validate and parse a password hash and fn new that creates a new hashed password from Password a parsed input provided by the user.



So in instances where we retrieve a user from the store, we parse the stored password, a hashed password string, to HashPassword::parse and not use the Password::Parse

Copy link
Owner

@letsgetrusty letsgetrusty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made you decide to go with a separate HashedPassword type instead of doing validation/hashing in the original Password type? I'm not suggesting one approach over the other, I just want to understand the trade offs.

@EleisonC
Copy link
Contributor Author

EleisonC commented Nov 22, 2025

@letsgetrusty I planned to extend the Password type, so I created a new HashPassword type first to get your feedback before proceeding. Based on your comments, I'm ready to merge the HashPassword logic into the existing Password type and deprecate HashPassword. Additionally, I'll add a function to Password that parses hashed password strings retrieved from the database when fetching data from the DataStore.

@letsgetrusty
Copy link
Owner

@EleisonC I doing see any new changes. Are you going to push them up?

@EleisonC
Copy link
Contributor Author

EleisonC commented Nov 22, 2025

I am making the changnes now

@EleisonC
Copy link
Contributor Author

Hey @letsgetrusty, sorry for the delay. This should be it. We only store a Hashed password; we never store the raw password. Only use the raw password in the login for user password validation

Copy link
Owner

@letsgetrusty letsgetrusty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just one small comment.

After addressing the comment please update ClickUp. Note that we'll need to check the sprint this change was introduced in and all future sprints.

We'll also need to make code updates to future sprints after this PR is merged.

@EleisonC EleisonC requested a review from letsgetrusty December 1, 2025 14:02
@EleisonC
Copy link
Contributor Author

EleisonC commented Dec 2, 2025

Rename Password to HashedPassword.

Update PostgresUserStore

@letsgetrusty What do you think

@letsgetrusty
Copy link
Owner

@EleisonC Can you checkout the branch for Sprint 4 and then follow the Sprint 5 instructions to see if you can implement the changes and the instructions are clear?

@EleisonC
Copy link
Contributor Author

EleisonC commented Dec 3, 2025

@EleisonC Can you checkout the branch for Sprint 4 and then follow the Sprint 5 instructions to see if you can implement the changes and the instructions are clear?

I see what you mean. I did what you suggested, and this is the new Password Hashing block

What do you think? @letsgetrusty

@letsgetrusty letsgetrusty merged commit fa004f4 into letsgetrusty:sprint-5-final-7-15 Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants