add README

This commit is contained in:
2025-10-02 11:53:53 +02:00
parent 1338bbb7d1
commit 53954ea4d9
3 changed files with 49 additions and 37 deletions

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# Account
This project implements a secure account management system.
## Features
* Create an account with a username, password, and 2FA.
* Passwords are securely salted and hashed using the PBKDF2 algorithm.
* 2FA is implemented using the TOTP algorithm.
* Create a session.
* Sessions are authenticated using randomly generated session tokens.
* Access and manage accounts and sessions.

View File

@@ -2,7 +2,7 @@
kotlin = "2.2.10" kotlin = "2.2.10"
ktor = "3.2.3" ktor = "3.2.3"
exposed = "0.61.0" exposed = "0.61.0"
migration = "1.0.2" migration = "1.1.0"
postgres = "42.7.5" postgres = "42.7.5"
random = "1.0.0" random = "1.0.0"
otp = "1.1.1" otp = "1.1.1"

View File

@@ -20,42 +20,42 @@ fun Application.configureDatabase() {
migration("initial") { migration("initial") {
exec( exec(
""" """
CREATE TABLE access CREATE TABLE access
( (
id BIGSERIAL id BIGSERIAL
PRIMARY KEY, PRIMARY KEY,
token_hash TEXT token_hash TEXT
NOT NULL NOT NULL
); );
CREATE TABLE account CREATE TABLE account
( (
id BIGSERIAL id BIGSERIAL
PRIMARY KEY, PRIMARY KEY,
username TEXT username TEXT
UNIQUE UNIQUE
NOT NULL, NOT NULL,
password_hash TEXT password_hash TEXT
NOT NULL, NOT NULL,
password_salt TEXT password_salt TEXT
NOT NULL, NOT NULL,
secret TEXT secret TEXT
NOT NULL, NOT NULL,
role TEXT role TEXT
NOT NULL NOT NULL
); );
CREATE TABLE session CREATE TABLE session
( (
id BIGSERIAL id BIGSERIAL
PRIMARY KEY, PRIMARY KEY,
token_hash TEXT token_hash TEXT
NOT NULL, NOT NULL,
account_id BIGINT account_id BIGINT
REFERENCES account (id) ON DELETE CASCADE REFERENCES account (id) ON DELETE CASCADE
NOT NULL NOT NULL
); );
""".trimIndent() """.trimIndent()
) )
AccountRepository.insert { AccountRepository.insert {