mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-05 23:29:58 +01:00
✨ Add basic credentials authentication
This commit is contained in:
5
src/utils/security.ts
Normal file
5
src/utils/security.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import bcrypt from "bcrypt";
|
||||
|
||||
export const hashPassword = (password: string, salt: string) => {
|
||||
return bcrypt.hashSync(password, salt);
|
||||
};
|
||||
11
src/utils/session.ts
Normal file
11
src/utils/session.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { randomUUID } from "crypto";
|
||||
|
||||
export const fromDate = (seconds: number, date = Date.now()) => {
|
||||
return new Date(date + seconds * 1000);
|
||||
};
|
||||
|
||||
// Helper functions to generate unique keys and calculate the expiry dates for session cookies
|
||||
export const generateSessionToken = () => {
|
||||
return randomUUID();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user