zitare-native/Sources/Core/Auth/AppConfig.swift
Till JS e139a382d8 fix(auth): keychainAccessGroup explizit auf TeamID.BundleID
Symptom: User wurden nach App-Update / längerer App-Pause aus-
geloggt, obwohl Refresh-Token theoretisch noch gültig war. Ursache:
mit `keychainAccessGroup: nil` landet das Token im impliziten
default-bucket; bei TestFlight-Cert-Drift oder Provisioning-
Profile-Wechsel wurde es nach Update für die neue App-Instanz
unzugänglich.

Bestehende Tokens werden via ManaCore v1.5.1 KeychainStore-
Migration-Fallback automatisch in den expliziten Bucket gespiegelt
— kein erzwungener Logout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 18:20:47 +02:00

46 lines
2.2 KiB
Swift

import Foundation
import ManaCore
/// App-spezifische Konfiguration für Zitare. Implementiert
/// `ManaAppConfig` aus ManaCore und ergänzt die Zitare-eigene
/// `apiBaseURL` (zitare-api, getrennt von mana-auth) sowie
/// `webBaseURL` (zitare.com, für WKWebView und Universal-Links)
/// und `appBaseURL` (zitare.mana.how, für eingeloggte Pfade).
enum AppConfig {
static let manaAppConfig: ManaAppConfig = DefaultManaAppConfig(
authBaseURL: URL(string: "https://auth.mana.how")!,
keychainService: "ev.mana.zitare",
// Explizit auf TeamID.BundleID, statt nil. Vermeidet Logout
// bei TestFlight-Cert-Drift (siehe mana-swift-core v1.5.1).
keychainAccessGroup: "QP3GLU8PH3.ev.mana.zitare"
)
/// `zitare-api.mana.how` API-Backend (Hono+Bun).
static let apiBaseURL = URL(string: "https://zitare-api.mana.how")!
/// `zitare.com` geplante öffentliche Domain (CC-BY-SA-Korpus,
/// statisch). Universal-Link-Domain für AASA. **Heute DNS noch
/// nicht live** (Cloudflare-Zone-Onboarding offen, siehe
/// `zitare/STATUS.md`); bis dahin nutzt der WebView `appBaseURL`
/// (`zitare.mana.how`) der Container liefert beide Surfaces.
static let publicWebURL = URL(string: "https://zitare.com")!
/// `zitare.mana.how` SPA-Surface, eingeloggte Pfade. Heute auch
/// der Default für Lese-Surfaces, bis `zitare.com` live ist.
static let appBaseURL = URL(string: "https://zitare.mana.how")!
/// Effektive Default-URL für den WebView. Zeigt vorerst auf
/// `appBaseURL` (`zitare.mana.how`); nach Cloudflare-Zone-Cut
/// kommt das zurück auf `publicWebURL`.
static let webBaseURL = appBaseURL
/// App-Group für Daten-Sharing zwischen App Widget ShareExt.
static let appGroup = "group.ev.mana.zitare"
/// Endpoint für den Korpus-Snapshot (Phase ζ-2). Heute noch nicht
/// als statische HTTP-Datei publiziert Aufgabe im Web-Repo:
/// `apps/zitare/static/index-min.json` aus dem Snapshot-Job
/// zusätzlich rauskopieren. Bis dahin schlägt der Pull mit 404
/// fehl und `SnapshotSync.tryRefresh()` macht fail-soft no-op.
static let snapshotURL = webBaseURL.appendingPathComponent("index-min.json")
}