2024-08-01 17:01:50 +00:00
|
|
|
module auth.data;
|
|
|
|
|
|
|
|
import handy_httpd.components.optional;
|
|
|
|
import auth.model;
|
|
|
|
|
|
|
|
/// The credentials provided by a user to login.
|
|
|
|
struct LoginCredentials {
|
|
|
|
string username;
|
|
|
|
string password;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// A token response sent to the user if they've been authenticated.
|
|
|
|
struct TokenResponse {
|
|
|
|
string token;
|
|
|
|
}
|
|
|
|
|
2024-09-11 20:15:53 +00:00
|
|
|
struct UsernameAvailabilityResponse {
|
|
|
|
bool available;
|
|
|
|
}
|
|
|
|
|
2024-08-01 17:01:50 +00:00
|
|
|
struct RegistrationData {
|
|
|
|
string username;
|
|
|
|
string password;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface UserRepository {
|
|
|
|
Optional!User findByUsername(string username);
|
|
|
|
User createUser(string username, string passwordHash);
|
|
|
|
void deleteByUsername(string username);
|
|
|
|
}
|