LifeMate — Personal, Family & Learning Companion
design/mobile-accessibility-v2
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 | import 'dart:convert'; |
| 2 | import 'dart:io'; |
| 3 | import 'package:flutter/foundation.dart'; |
| 4 | import 'package:http/io_client.dart'; |
| 5 | |
| 6 | IOClient createClient() { |
| 7 | const publicCa = String.fromEnvironment('LIFEGUIDE_DEBUG_CA_BASE64'); |
| 8 | if (publicCa.isNotEmpty && !kDebugMode) { |
| 9 | throw StateError( |
| 10 | 'Custom development CA is forbidden outside debug builds.'); |
| 11 | } |
| 12 | final context = SecurityContext(withTrustedRoots: true); |
| 13 | if (publicCa.isNotEmpty) { |
| 14 | final bytes = base64Decode(publicCa); |
| 15 | if (bytes.length > 65536) { |
| 16 | throw ArgumentError('Public development CA exceeds 64 KiB.'); |
| 17 | } |
| 18 | if (utf8.decode(bytes).contains('PRIVATE KEY')) { |
| 19 | throw ArgumentError('Only a public CA certificate may be supplied.'); |
| 20 | } |
| 21 | context.setTrustedCertificatesBytes(bytes); |
| 22 | } |
| 23 | return IOClient(HttpClient(context: context) |
| 24 | ..connectionTimeout = const Duration(seconds: 15)); |
| 25 | } |