First commit

This commit is contained in:
2026-10-27 12:42:57 +01:00
commit 7dd9f4b14d
74 changed files with 33018 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { hashPassword, verifyPassword } from '../src/accounts.js'
test('passwords are salted and verified', async () => {
const first = await hashPassword('correct horse battery staple')
const second = await hashPassword('correct horse battery staple')
assert.notEqual(first.salt, second.salt)
assert.notEqual(first.hash, second.hash)
assert.equal(await verifyPassword('correct horse battery staple', first.salt, first.hash), true)
assert.equal(await verifyPassword('wrong password', first.salt, first.hash), false)
})