• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 28703239231

04 Jul 2026 10:24AM UTC coverage: 67.243% (+0.5%) from 66.747%
28703239231

Pull #641

github

web-flow
Merge 61c30c815 into 8ab482559
Pull Request #641: feat: add admin backend foundation (login, session, health)

2019 of 3370 branches covered (59.91%)

Branch coverage included in aggregate %.

198 of 231 new or added lines in 20 files covered. (85.71%)

4632 of 6521 relevant lines covered (71.03%)

24.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.1
/src/utils/admin-password.ts
1
import { randomBytes, scryptSync, timingSafeEqual } from 'crypto'
2✔
2

3
const SCRYPT_PREFIX = 'scrypt'
2✔
4

5
export const hashAdminPassword = (password: string): string => {
2✔
6
  const salt = randomBytes(16)
1✔
7
  const hash = scryptSync(password, salt, 64)
1✔
8
  return `${SCRYPT_PREFIX}:${salt.toString('base64')}:${hash.toString('base64')}`
1✔
9
}
10

11
export const verifyAdminPasswordHash = (password: string, storedHash: string): boolean => {
2✔
12
  const parts = storedHash.split(':')
1✔
13
  if (parts.length !== 3 || parts[0] !== SCRYPT_PREFIX) {
1!
NEW
14
    return false
×
15
  }
16

17
  const [, saltB64, hashB64] = parts
1✔
18
  const salt = Buffer.from(saltB64, 'base64')
1✔
19
  const expected = Buffer.from(hashB64, 'base64')
1✔
20
  const actual = scryptSync(password, salt, expected.length)
1✔
21

22
  if (expected.length !== actual.length) {
1!
NEW
23
    return false
×
24
  }
25

26
  return timingSafeEqual(expected, actual)
1✔
27
}
28

29
export const verifyPlaintextPassword = (password: string, expectedPassword: string): boolean => {
2✔
30
  const expected = Buffer.from(expectedPassword, 'utf8')
3✔
31
  const actual = Buffer.from(password, 'utf8')
3✔
32

33
  if (expected.length !== actual.length) {
3✔
34
    return false
1✔
35
  }
36

37
  return timingSafeEqual(expected, actual)
2✔
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc