LifeMate — Personal, Family & Learning Companion
feat/private-planner-series-api
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | # LifeGuide — Kavenegar VerifyLookup SMS OTP configuration (QA only) |
| 2 | |
| 3 | Status: **ADAPTER SOURCE PREPARED, LIVE SMS DISABLED / UNVERIFIED** |
| 4 | Prepared: 2026-10-15 |
| 5 | Source branch: `infra/lifeguide-supabase-qa` |
| 6 | Provider confirmed by owner screenshots: Kavenegar `console.kavenegar.com`. Owner's masked API key is visible only in their own authenticated console; it was **not retrieved or stored**. |
| 7 | |
| 8 | ## Exact pattern to create in Kavenegar console |
| 9 | |
| 10 | Path: اعتبارسنجی → ایجاد الگوی جدید |
| 11 | |
| 12 | | Kavenegar field | QA / LifeGuide value | |
| 13 | | --- | --- | |
| 14 | | نوع استفاده | موبایل اپلیکیشن | |
| 15 | | نام الگو (template) | `lifeguideotp` | |
| 16 | | نوع ارسال | پیامک | |
| 17 | | ارسال مجدد با مسیر جایگزین | غیرفعال | |
| 18 | | متن الگو | See below | |
| 19 | |
| 20 | ```text |
| 21 | کد تأیید LifeGuide: %token |
| 22 | |
| 23 | اعتبار کد: ۵ دقیقه |
| 24 | این کد را در اختیار دیگران قرار ندهید. |
| 25 | ``` |
| 26 | |
| 27 | - Keep the literal **`%token`** intact. Its value is generated server-side as a six-digit number (may have a leading zero). |
| 28 | - Name of system **LifeGuide** is included. Provider must approve the SMS template before sending is enabled. |
| 29 | - Do **not** paste the API key, reveal the key with the eye icon, copy the key into chat, screenshots, Flutter, PWA or public GitHub. |
| 30 | - Account balance in owner screenshot is 50,000 rials; that is a **finite prepaid balance**, not free SMS. No actual SMS should be sent during preparations without owner approval for charged sends. |
| 31 | |
| 32 | Official API documentation: |
| 33 | - https://github.com/kavenegar/kavenegar-node — `VerifyLookup({ receptor, token, template })` |
| 34 | - https://www.postman.com/kavenegarrestapi/kavenegar-s-public-workspace/documentation/v5ppwag/kavenegar-rest-api — endpoint `GET /v1/<API-KEY>/verify/lookup.json` with `receptor`, `token`, `template`, optional `type=sms`. |
| 35 | |
| 36 | ## Actual code preparation |
| 37 | |
| 38 | - Dedicated backend module: `backend/src/kavenegar_sms.js`, selected only with explicit `SMS_PROVIDER=kavenegar`. |
| 39 | - `backend/src/auth_delivery.js` retains the original disabled/default and HTTPS webhook behavior; it is **not** switched on by default. |
| 40 | - Example environment keys: |
| 41 | - `SMS_PROVIDER=kavenegar` |
| 42 | - `SMS_LIVE_ENABLED=true` only after explicit owner authorization for live sending. |
| 43 | - `KAVENEGAR_TEMPLATE_APPROVED=true` only after the provider approves this exact template. |
| 44 | - `KAVENEGAR_TEMPLATE=lifeguideotp` |
| 45 | - `KAVENEGAR_API_KEY=<secret value in server/secret manager ONLY>` |
| 46 | - Adapter restricts to Iranian mobile numbers normalized by existing LifeGuide `normalizePhone()` as `+989XXXXXXXXX`; Kavenegar receives `09XXXXXXXXX`. |
| 47 | - Fixed official HTTPS API host, redirect disabled, 10s maximum timeout, sanitized provider errors, no provider response/error body in logs, no automatic retries (Kavenegar `VerifyLookup` has **no idempotency key**, so retry could produce duplicate and charge again). |
| 48 | - A provider return status 200 is **acceptance only**, never proof of handset delivery. Failure response 200 with `return.status != 200` is treated as failed. |
| 49 | - LifeGuide's current original auth flow supplies 6-digit OTP, 5-minute expiry, recipient request limits, maximum failed attempts, and independent session checks. This adapter is **delivery only** and must never issue sessions or bypass guardian authorization. |
| 50 | |
| 51 | ## Gates remaining |
| 52 | |
| 53 | 1. Owner completes/obtains approval for `lifeguideotp` pattern. Only ask for the pattern **name and approval status**, no secret. |
| 54 | 2. CI must confirm synthetic mocked transport tests, syntax/security and all Backend regression tests on the isolated branch. No live provider API or real phone send is exercised by mocked tests. |
| 55 | 3. Prepare an **approved secure backend runtime** (existing Node/Express currently has no online host) and separate Supabase QA application schema/auth authorization parity. The Supabase `LifeGuide-QA` database plus `lifeguide-qa-health` probe are **not** a functioning family API. |
| 56 | 4. Put Kavenegar key in a **private secret manager** for that runtime only, after owner approves credential placement. Never read key back to chat or logs. |
| 57 | 5. Obtain separate owner approval for **one real paid SMS** to an owner-controlled test phone. Check approval of pattern, actual reception, repeat/expired code behavior and sanitized provider response; record no phone/OTP in report. |
| 58 | 6. Only after that and successful API integration separately discuss switching public `app.lifeguide.ir`/Android/PWA or releasing production. |
| 59 | 7. Confirm provider reachability and permitted access from the final hosting environment; do not assume foreign server can reach Kavenegar API. |
| 60 | |
| 61 | This preparation changes neither Supabase QA secret configuration nor the live `app.lifeguide.ir` deployment. The original SQL application tables, Android/Safari tests and real SMS remain **UNVERIFIED**. |