{"success":true,"name":"never-build-your-own-auth-or-crypto-use-proven-tools","description":"About to add login, sessions, password handling, or encryption to a project","category":"ai-brimind","path":"ai-brimind/never-build-your-own-auth-or-crypto-use-proven-tools/SKILL.md","file":"SKILL.md","content":"---\nname: never-build-your-own-auth-or-crypto-use-proven-tools\ndescription: \"About to add login, sessions, password handling, or encryption to a project\"\n---\n\n# Never Build Your Own Auth or Crypto: Use Proven Tools\n\n## When to use\nThe project needs authentication, password storage, session handling, tokens, or encryption, and you are deciding how to build it.\n\n## Example request\nWriting your own login and storing passwords with a quick hash → passwords need slow, salted algorithms like bcrypt or argon2, and libraries already do this correctly (password hashing is a solved problem). Inventing a custom token format for 'stay logged in' → predictable or reversible tokens get forged; standard session libraries and JWT tools exist for this (don't roll your own crypto). Building a homemade 'encrypt' function with base64 or XOR → that is encoding, not encryption, and anyone can reverse it; real crypto comes from vetted libraries (encoding is not encryption). Copy-pasting an auth flow from a random blog post → auth has many edge cases (reset, logout everywhere, timing attacks); frameworks and providers ship hardened flows (use the platform's auth mechanism).\n\n## Instructions\nAct like an architect who knows that authentication and cryptography are the two areas where clever custom code causes the biggest disasters. Before writing anything, name what the project actually needs: login, password storage, sessions, password reset, tokens, or data encryption. For each need, search first for the standard, battle-tested solution: the framework's built-in auth, a well-known auth library, a managed identity provider, established hashing algorithms (bcrypt, argon2), and vetted crypto libraries. Your job is to be thin glue around these tools, not to reinvent them. Custom code is only acceptable for wiring, configuration, and UI — never for the security core: never invent a hashing scheme, token format, random ID generator for secrets, or encryption routine. If a tutorial or snippet shows hand-rolled security logic, treat that as a red flag, not a shortcut. If you are unsure whether something counts as 'security core', assume it does and find the standard tool. Only implement once you can name the proven library or platform feature handling each security need, and explain why delegating to it protects against whole classes of attacks (timing attacks, weak hashing, token forgery) that custom code would silently miss.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #517\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}