class SecretKeyService { public function validate(PDO $pdo, CryptoService $crypto, string $inputKey): ?int { $hash = $crypto->hash($inputKey); // 🔍 DEBUG LOG error_log("SECRET KEY ENTERED: [$inputKey]"); error_log("SECRET KEY HASH (PHP): [$hash]"); $stmt = $pdo->prepare(" SELECT id, HEX(key_hash) AS db_hash FROM secret_keys WHERE is_active = 1 AND valid_from <= UTC_TIMESTAMP() AND valid_to >= UTC_TIMESTAMP() LIMIT 1 "); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row) { error_log("SECRET KEY HASH (DB): [" . $row['db_hash'] . "]"); return $row['id']; } error_log("NO MATCH FOUND"); return null; } } Access Form

Paritosh