core.constants¶
src.core.constants
¶
Centralized constants for internal implementation details.
This module contains constants that are internal implementation details,
NOT environment-specific configuration. For environment-specific settings,
use src/core/config.py instead.
Categories: - Token lengths: Fixed sizes for cryptographic tokens and keys - Timeouts: Default timeouts for external service calls - Prefixes: Standard protocol prefixes - Limits: Truncation and safety limits
Reference
- docs/architecture/configuration.md (to be added)
- WARP.md Section 0 (Established Configuration Pattern)
Example
from src.core.constants import TOKEN_BYTES, BEARER_PREFIX token = secrets.token_bytes(TOKEN_BYTES) header = f"{BEARER_PREFIX}{access_token}"
Attributes¶
TOKEN_BYTES
module-attribute
¶
Number of bytes for secure token generation (32 bytes = 256 bits).
TOKEN_HEX_LENGTH
module-attribute
¶
Length of hex-encoded token string (TOKEN_BYTES * 2).
BCRYPT_ROUNDS_DEFAULT
module-attribute
¶
Default bcrypt work factor (cost parameter).
PROVIDER_TIMEOUT_DEFAULT
module-attribute
¶
Default timeout for external provider API calls in seconds.
BEARER_PREFIX
module-attribute
¶
HTTP Authorization header prefix for Bearer tokens.
RESPONSE_BODY_MAX_LENGTH
module-attribute
¶
Maximum length for response body in error messages (truncation limit).
SSE_HEARTBEAT_INTERVAL_SECONDS
module-attribute
¶
Interval between SSE heartbeat comments to detect stale connections.
SSE_RETRY_INTERVAL_MS
module-attribute
¶
Client reconnection interval hint (milliseconds).
SSE_CHANNEL_PREFIX
module-attribute
¶
Redis channel prefix for SSE pub/sub.
SSE_RETENTION_MAX_LEN_DEFAULT
module-attribute
¶
Default max events per user in Redis Stream retention.
SSE_RETENTION_TTL_DEFAULT
module-attribute
¶
Default TTL for retained events (seconds).