domain.protocols.password_reset_token_service_protocol¶
src.domain.protocols.password_reset_token_service_protocol
¶
PasswordResetTokenServiceProtocol - Domain protocol for password reset token operations.
This protocol defines the interface for password reset token generation. Infrastructure provides the concrete implementation (PasswordResetTokenService).
Following hexagonal architecture: - Domain defines what it needs (protocol/port) - Infrastructure provides implementation (adapter) - Application layer uses protocol, not concrete implementation
Classes¶
PasswordResetTokenServiceProtocol
¶
Bases: Protocol
Protocol for password reset token generation.
Generates unguessable tokens for password reset links. Very short-lived (15 minutes) for security.
Implementations
- PasswordResetTokenService: src/infrastructure/security/password_reset_token_service.py
Source code in src/domain/protocols/password_reset_token_service_protocol.py
Functions¶
generate_token
¶
Generate password reset token.
Returns:
| Type | Description |
|---|---|
str
|
64-character hex string (32 bytes of entropy). |
calculate_expiration
¶
Calculate expiration timestamp for new token.
Returns:
| Type | Description |
|---|---|
datetime
|
Expiration datetime (UTC) based on configured expiration_minutes. |