Passwords

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

Updated

  1. Storing Passwords Safely: Hashing (Journeyman): An app never keeps a password itself; it keeps a bcrypt hash, a one-way fingerprint made with a random salt and a slow cost factor, and it checks each sign-in with bcryptjs's compare.
  2. Sign-Up and Sign-In Routes (Journeyman): A sign-up route hashes the password, saves the student behind a unique index on email and answers 409 for an email that's taken, and a sign-in route checks the password with compare and answers one vague 401 for any mistake, never sending a hash back.