auth
This commit is contained in:
37
core/identity/domain/repositories/IMagicLinkRepository.ts
Normal file
37
core/identity/domain/repositories/IMagicLinkRepository.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
|
||||
export interface PasswordResetRequest {
|
||||
email: string;
|
||||
token: string;
|
||||
expiresAt: Date;
|
||||
userId: string;
|
||||
used?: boolean;
|
||||
}
|
||||
|
||||
export interface IMagicLinkRepository {
|
||||
/**
|
||||
* Create a password reset request
|
||||
*/
|
||||
createPasswordResetRequest(request: PasswordResetRequest): Promise<void>;
|
||||
|
||||
/**
|
||||
* Find a password reset request by token
|
||||
*/
|
||||
findByToken(token: string): Promise<PasswordResetRequest | null>;
|
||||
|
||||
/**
|
||||
* Mark a token as used
|
||||
*/
|
||||
markAsUsed(token: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Check rate limiting for an email
|
||||
* Returns Result.ok if allowed, Result.err if rate limited
|
||||
*/
|
||||
checkRateLimit(email: string): Promise<Result<void, { message: string }>>;
|
||||
|
||||
/**
|
||||
* Clean up expired tokens
|
||||
*/
|
||||
cleanupExpired(): Promise<void>;
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
export interface UserCredentials {
|
||||
email: string;
|
||||
passwordHash: string;
|
||||
salt: string;
|
||||
}
|
||||
|
||||
export interface StoredUser {
|
||||
@@ -15,7 +14,7 @@ export interface StoredUser {
|
||||
email: string;
|
||||
displayName: string;
|
||||
passwordHash: string;
|
||||
salt: string;
|
||||
salt?: string;
|
||||
primaryDriverId?: string | undefined;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user