Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dd2cb16
chore: update CHANGELOG
jsjoeio May 19, 2021
cac6673
refactor: use bcrypt in hash function
jsjoeio May 19, 2021
17be8c5
refactor: use bcrypt in e2e setup
jsjoeio May 19, 2021
f35120c
feat: add unit test for hash function
jsjoeio May 19, 2021
aaf0447
refactor: add functions to check hash password
jsjoeio May 19, 2021
fc3326f
feat: add tests using real hashes
jsjoeio May 20, 2021
dc2db5c
chore: add argon2 package
jsjoeio Jun 2, 2021
51f8341
chore: update to argon2 in test
jsjoeio Jun 2, 2021
70197bb
refactor: use argon2 instead of bcrypt
jsjoeio Jun 2, 2021
fd3cb6c
refactor: update unit tests for hash fns
jsjoeio Jun 2, 2021
fcc3f0d
refactor: update login logic with new async hashing
jsjoeio Jun 2, 2021
0cdbd33
refactor: make authenticated async everywhere
jsjoeio Jun 2, 2021
91303d4
refactor: make ensureAuthenticated async
jsjoeio Jun 2, 2021
1134780
refactor: make wsProxy async
jsjoeio Jun 2, 2021
788b958
refactor: update hash fn in test config
jsjoeio Jun 2, 2021
ffa5c16
feat: update cli and test for hashed-password
jsjoeio Jun 2, 2021
7ff4117
feat: add getPasswordMethod & test for it
jsjoeio Jun 2, 2021
a14ea39
feat: add handlePasswordValidation + tests
jsjoeio Jun 2, 2021
409b473
refactor: rewrite password logic at /login
jsjoeio Jun 2, 2021
6020480
feat: add isCookieValid function and tests
jsjoeio Jun 3, 2021
923761c
refactor: password logic in http w/ isCookieValid
jsjoeio Jun 3, 2021
517aaf7
docs: update FAQ with new hashing instructions
jsjoeio Jun 3, 2021
531b7c0
feat: add splitOnFirstEquals function
jsjoeio Jun 3, 2021
8c2bb61
refactor: parse options with multiple = in cli
jsjoeio Jun 3, 2021
deaa224
feat: add npm_config_build_from_source to build scripts
jsjoeio Jun 7, 2021
3b50bfc
fix: sanitize password and cookie key
jsjoeio Jun 7, 2021
1e55a64
feat: check for empty str in isHashMatch
jsjoeio Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: update hash fn in test config
  • Loading branch information
jsjoeio committed Jun 8, 2021
commit 788b958e200708348f575e5c8076a367c1133f6f
10 changes: 6 additions & 4 deletions test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import {
Config,
globalSetup,
} from "@playwright/test"
import * as bcrypt from "bcrypt"
import * as argon2 from "argon2"
import path from "path"
import { PASSWORD } from "./utils/constants"
import * as wtfnode from "./utils/wtfnode"

// Playwright doesn't like that ../src/node/util has an enum in it
// so I had to copy hash in separately
const hash = (str: string): string => {
return bcrypt.hashSync(str, 10)
const hash = async (str: string): Promise<string> => {
return await argon2.hash(str)
}

const cookieToStore = {
sameSite: "Lax" as const,
name: "key",
value: hash(PASSWORD),
value: "",
domain: "localhost",
path: "/",
expires: -1,
Expand All @@ -38,6 +38,8 @@ globalSetup(async () => {
wtfnode.setup()
}

cookieToStore.value = await hash(PASSWORD)

const storage = {
cookies: [cookieToStore],
}
Expand Down