Passwords

Passwords: Storing Passwords Safely: Hashing with pwdlib, Sign-Up and Sign-In Routes.

Updated

  1. Storing Passwords Safely: Hashing with pwdlib (Journeyman): An API never stores a password, plain or encrypted, only a slow, salted, one-way hash of it made with Argon2 through pwdlib's PasswordHash.recommended(), and it checks each sign-in attempt with verify.
  2. Sign-Up and Sign-In Routes (Journeyman): A students table with a password_hash column and a UNIQUE email holds the accounts, a sign-up route hashes the password and answers 201 with the new student or 409 for a used email, a response model keeps the hash out of every answer, and sign-in answers a wrong email and a wrong password with the same 401.