34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
/**
|
|
* Repository for single-use email verification tokens.
|
|
* Stores hashed tokens with expiry; marks tokens used after successful verification.
|
|
*/
|
|
/**
|
|
* Removes all verification tokens for a user (before issuing a new one).
|
|
* @param userId - User UUID
|
|
*/
|
|
export declare function deleteByUserId(userId: string): Promise<void>;
|
|
/**
|
|
* Inserts a new verification token row.
|
|
* @param userId - User UUID
|
|
* @param tokenHash - SHA-256 hash of the raw token
|
|
* @param expiresAt - Expiration timestamp
|
|
*/
|
|
export declare function create(userId: string, tokenHash: string, expiresAt: Date): Promise<void>;
|
|
/**
|
|
* Finds a valid unused token by hash.
|
|
* @param tokenHash - SHA-256 hash of the raw token from the verify link
|
|
*/
|
|
export declare function findValidByTokenHash(tokenHash: string): Promise<{
|
|
id: string;
|
|
user_id: string;
|
|
} | null>;
|
|
/**
|
|
* Marks a token as used so it cannot be replayed.
|
|
* @param id - Token row UUID
|
|
*/
|
|
export declare function markUsed(id: string): Promise<void>;
|
|
/**
|
|
* Deletes expired or used tokens (housekeeping).
|
|
*/
|
|
export declare function deleteStale(): Promise<void>;
|
|
//# sourceMappingURL=emailVerificationRepository.d.ts.map
|