finnow/finnow-api/source/auth/data.d

31 lines
627 B
D
Raw Normal View History

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;
}
struct UsernameAvailabilityResponse {
bool available;
}
struct RegistrationData {
string username;
string password;
}
interface UserRepository {
Optional!User findByUsername(string username);
User createUser(string username, string passwordHash);
void deleteByUsername(string username);
}