전체 글 187

Authentication Level 4 - Hide your Secrets with Environment Variables

//.env file SESSION_SECRET="TOPSECRETWORD" PG_USER="postgres" PG_HOST="localhost" PG_DATABASE="secrets" PG_PASSWORD="123456" PG_PORT="5432" // solution.js // Not code written by me. This is example code import express from "express"; import bodyParser from "body-parser"; import pg from "pg"; import bcrypt from "bcrypt"; import passport from "passport"; import { Strategy } from "passport-local"; ..

프로그래밍/Web 2024.04.12

Authentication Level 2 - Encryption and Hashing + How to Salt Passwords for Improved Encryption

// solution.js // Not code written by me. This is example code import express from "express"; import bodyParser from "body-parser"; import pg from "pg"; import bcrypt from "bcrypt"; const app = express(); const port = 3000; const saltRounds = 10; app.use(bodyParser.urlencoded({ extended: true })); app.use(express.static("public")); const db = new pg.Client({ user: "postgres", host: "localhost", ..

카테고리 없음 2024.04.10