Principle:1jehuang Jcode OAuth Account Tracking
| Knowledge Sources | |
|---|---|
| Domains | Telemetry, Privacy |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
A privacy-preserving pattern for tracking model-provider OAuth account membership by storing only SHA-256 email hashes and installation-scoped UUIDs, never raw emails in queryable fields, with membership queries gated by installation knowledge.
Description
OAuth account tracking is a telemetry pattern for correlating which provider accounts (Anthropic, OpenAI, Gemini, Copilot, Antigravity) a jcode installation uses, without exposing the user's email address. The system stores the raw email only in the insert path (for deduplication), computes a SHA-256 hash, and uses the hash for all subsequent membership queries. The email is never exposed in queryable fields, and database errors never echo payloads or hashes.
The problem solved is privacy in telemetry: a telemetry system needs to know which provider accounts are associated with which installations (for support, feature gating, or account linking), but storing raw emails creates a privacy risk. By hashing emails and gating membership queries on installation knowledge (the UUID must be known before an email hash query is accepted), the system minimizes exposure.
The design includes no CORS access (browser requests are forbidden), body size limits (1 KiB), and strict input validation (UUID format, email format, provider set membership).
Usage
Use this principle when a telemetry system needs to track OAuth account membership without exposing raw credentials. The trigger is: "the system needs to know if a provider account is already tracked for a given installation." It is appropriate for: account linking, feature gating, and installation-scoped support lookup.
Theoretical Basis
The tracking protocol has two operations:
- Insert:
POST /v1/oauth-accountwith{id, provider, email}. The email is validated, lowercased, and SHA-256 hashed. The record is inserted withON CONFLICT DO NOTHINGdeduplication. The response is always{ok: true}— insertion/dedup status is never exposed as an account-membership oracle. - Check:
POST /v1/oauth-account/checkwith{id, provider, email_hash}. The system first checks if the installation UUID is known (exists inevents,daily_active_users, oroauth_accounts). Only if known, it checks if the email hash is tracked for that provider. The response is{installation_known: bool, email_tracked: bool}.
Pseudo-code logic:
# Abstract algorithm (NOT real implementation)
def insert_account(body):
uuid = validate_uuid(body.id)
provider = validate_provider(body.provider)
email = validate_email(body.email)
email_hash = sha256(email.lower())
db.execute(
"INSERT INTO oauth_accounts VALUES (?, ?, ?, ?) "
"ON CONFLICT DO NOTHING",
uuid, provider, email, email_hash
)
return {"ok": True} # Never reveal dedup status
def check_account(body):
uuid = validate_uuid(body.id)
provider = validate_provider(body.provider)
email_hash = validate_hash(body.email_hash)
known = db.query(
"SELECT EXISTS(... WHERE telemetry_id = ?)", uuid
)
if not known:
return {"installation_known": False, "email_tracked": False}
tracked = db.query(
"SELECT EXISTS(... WHERE telemetry_id = ? "
"AND provider = ? AND email_hash = ?)",
uuid, provider, email_hash
)
return {"installation_known": True, "email_tracked": tracked}