Skip to content

10 Integrations

Vicky Patel edited this page Sep 14, 2026 · 1 revision

10. External Proof Connectors & Integrations

Technical specifications for external proof-of-work connectors and third-party API sync engines.


🔗 Overview of Implemented Connectors

PACT OS integrates with external platforms to verify proof of work automatically:

graph LR
    Sub[User Proof Submission] --> Router[Integration Engine src/lib/integrations/]
    Router -->|Git Commit / PR| GH[GitHub API Connector]
    Router -->|Problem Submission| LC[LeetCode GraphQL Connector]
    Router -->|Contest / Rating| CF[Codeforces REST Connector]
    Router -->|Timeblock Sync| GCal[Google Calendar Sync Engine]
Loading

🛠️ Connector Specifications

1. GitHub Proof Connector (src/lib/integrations/github.ts)

  • Purpose: Verifies developer proof of work using public GitHub commit hashes or Pull Request URLs.
  • Verification Flow:
    1. Parses repository owner, repo name, and commit/PR SHA from submission payload.
    2. Queries GitHub REST API (https://api.github.com/repos/{owner}/{repo}/commits/{sha}).
    3. Verifies commit author matches user's linked GitHub handle.
  • Response Handling: Stores raw verification response in external_proof_submissions.raw_response.

2. LeetCode GraphQL Connector (src/lib/integrations/leetcode.ts)

  • Purpose: Verifies algorithmic problem-solving proofs.
  • Verification Flow:
    1. Queries LeetCode GraphQL API endpoint (https://leetcode.com/graphql).
    2. Inspects recentSubmissionList query for target problem titleSlug.
    3. Verifies submission status equals "Accepted" within the commitment window.

3. Codeforces REST Connector (src/lib/integrations/codeforces.ts)

  • Purpose: Verifies competitive programming submission status and contest rating tier badges.
  • Verification Flow:
    1. Calls Codeforces API (https://codeforces.com/api/user.status).
    2. Validates problem ID and verdict (OK).

4. Google Calendar Bi-Directional Sync (src/lib/integrations/google-calendar.ts)

  • Purpose: Time-blocks PACT OS commitments directly into user's Google Calendar.
  • Authentication: Handles OAuth2 token refresh via Google APIs.
  • Sync Mapping: Maps tasks.scheduled_start and tasks.deadline_at to Google Calendar event start and end timestamps.

🛡️ Failure & Outage Resilience

  • Transient Outages: External API rate-limiting or network timeouts do NOT mark commitments as breached immediately.
  • Retry Queue: Submissions transition status to retry_pending until verified or manually reviewed.
  • Zero Token Leakage: External API tokens remain encrypted in database table user_integrations.

Clone this wiki locally