# Privacy Policy

**Effective Date: October 19, 2026** 
**Version: 2.6 (Multi-Tenant Local-First Dashboard & Account Merging Update)**

This Privacy Policy ("Policy") governs the collection, processing, storage, and protection of user information by **Telelibra Knowledge Cloud** and **ScrapLibra Web SaaS** ("Service", "Company", "We"). We are committed to radical transparency, Privacy-by-Design, and strict compliance with the EU General Data Protection Regulation (GDPR 2016/679).

---

## 1. Data Controller & Legal Bases
1.1. **Data Controller**: Developer and operations team of Telelibra (`support@telelibra.cloud`). 
1.2. **Legal Bases for Processing (GDPR Art. 6)**:
* **Contract Performance (Art. 6(1)(b))**: link parsing, note synthesis, Obsidian Vault / NotebookLM export packaging, and billing.
* **Legitimate Interests (Art. 6(1)(f))**: infrastructure reliability, fraud prevention, MCP gateway security, and AI worker latency optimization.
* **Explicit Informed Consent (Art. 6(1)(a))**: mandatory onboarding agreement before tariff selection.
* **Compliance with Legal Obligations (Art. 6(1)(c))**: financial record keeping and GDPR erasure audit trails.

---

## 2. Data Categories & Automated Privacy Shields
### 2.1. Voluntarily Submitted Data:
* **Account Identifiers**: Telegram ID, username, or normalized email and cryptographically stretched password hashes (PBKDF2-HMAC-SHA256, 600,000 iterations + 16-byte cryptographic salt). Plaintext passwords are never received or stored.
* **User Content**: URLs, messages, articles, videos, and chat history export files (`messages.html` / `result.json`) deliberately submitted to the bot or Web Dashboard.
* **Synthesized Knowledge Base**: Obsidian Markdown notes, tags, 20-category taxonomy assignments, and search indices.
* **Payment Identifiers**: Telegram Stars and payment provider transaction reference IDs (credit card numbers and CVV codes are **never received or stored**).

### 2.2. Automated Pre-Ingestion Privacy Shields:
* **Zero-Credit Noise Shield**: System export notices (*"Not included, change data exporting settings to download"*), media placeholders, and emojis are dropped locally with **zero credits deducted**.
* **Sensitive Data Filter**: Bank card numbers, phone numbers, OTP verification codes, and banking keywords are detected locally. They are **never sent to external AI APIs** and never saved to databases.
* **Canonical URL Normalization**: Marketing tracking parameters (`fbclid`, `utm_*`) are stripped to prevent duplicate billing and tracking leaks.
* **Local-First Client Storage (IndexedDB)**: Web Dashboard edits are cached client-side in browser IndexedDB. Upon session timeout or network interruption (HTTP 401), user drafts are preserved locally and never discarded.
* **Non-Custodial Account Merging**: Merging a Telegram profile with a Web Dashboard account uses deterministic mapping (`users_lookup`). Notes and purchased credits are merged atomically without cross-tenant exposure.
* **Permanent Read-Only Archive Protection**: Stored notes are preserved in isolated tenant storage in perpetuity and are never purged or exposed to other tenants, surviving until explicit GDPR erasure.

---

## 3. Operational Analytics Ledger
3.1. We maintain a structured operational audit log in `data/telelibra_analytics.db`. 
3.2. **Logged Events**:
* `user_registered`: Workspace creation timestamp.
* `consent_accepted`: Legal proof of informed consent prior to payment.
* `payment_success`: Telegram Stars transaction audit record.
* `sync_started` & `sync_completed`: Ingestion duration, note count, and credit accounting.
* `export_requested`: Archive generation trigger.
* `export_acknowledged`: **Proof of Digital Delivery**: user clicks "OK" in the export modal, confirming receipt of the knowledge base.
* `mcp_connected` / `mcp_call`: Remote AI agent tool invocation audit.
* `data_deleted`: GDPR Article 17 audit entry confirming permanent deletion. 
3.3. **Zero Content in Logs**: Note contents, article texts, and personal documents are strictly excluded from the analytics database.

---

## 4. AI Processing Guarantees (Inference-Only)
4.1. Text analysis is conducted via **Google Cloud Vertex AI / Gemini 3.5 Flash**. 
4.2. **Zero-Training Guarantee**: In accordance with Google Cloud enterprise privacy standards, user content is processed strictly in real-time inference mode and **is never used to train, improve, or fine-tune foundation AI models**.

---

## 5. Cryptographic Anti-Spoofing & Archive Protection (HMAC-SHA256)
5.1. Direct unauthenticated downloads via raw `user_uuid` paths are blocked. 
5.2. Vault archives are downloaded exclusively via time-limited, HMAC-SHA256 signed cryptographic tokens (`GET /export/download/{token}`). 
5.3. Tokens expire in 15–30 minutes, and constant-time signature verification (`hmac.compare_digest`) prevents User ID tampering and timing attacks.

---

## 6. Zero-Trace Logging
6.1. PII scrubbers intercept and redact access tokens, emails, and phone numbers before logs are written to disk. 
6.2. Server logs contain only sanitized technical telemetry.

---

## 7. GDPR Rights (Articles 15–22)
* **Right to Data Portability (Art. 20)**: Download your entire Second Brain at any time via `/export` as an Obsidian Vault `.zip` or NotebookLM `.md`.
* **Right to Erasure (Art. 17)**: Send `/delete_my_data` to permanently wipe all notes, databases, tokens, and billing records within 1 second.
* **Privacy Inquiries**: Contact via `/paysupport` or `support@telelibra.cloud`.