Account settings page.

This commit is contained in:
Mike Cao 2020-08-08 23:48:43 -07:00
parent 58a1be7a30
commit b5cf9f8719
32 changed files with 597 additions and 162 deletions

View file

@ -3,6 +3,7 @@ import { v4, v5, validate } from 'uuid';
import bcrypt from 'bcrypt';
import { JWT, JWE, JWK } from 'jose';
const SALT_ROUNDS = 10;
const KEY = JWK.asKey(Buffer.from(secret()));
export function hash(...args) {
@ -23,6 +24,10 @@ export function isValidId(s) {
return validate(s);
}
export function hashPassword(password) {
return bcrypt.hash(password, SALT_ROUNDS);
}
export function checkPassword(password, hash) {
return bcrypt.compare(password, hash);
}