readServiceAccount static method
Future<void>
readServiceAccount(
)
Implementation
static Future<void> readServiceAccount() async {
// SECURITY: a service account JSON bundled in a client app is a critical
// leak — anyone can extract it from the APK/IPA and mint OAuth tokens.
// Push notifications are proxied via Cloud Functions (sendNotificationViaCloud).
// The asset is only loaded when explicitly allowed for admin tooling
// ('allowClientServiceAccount': true in properties.json) or in debug builds.
final bool allowClient = _config is Map && _config['allowClientServiceAccount'] == true;
if (kIsWeb || (!allowClient && !kDebugMode)) {
neomLogger.t("readServiceAccount skipped on client (security) — using Cloud Functions proxy");
return;
}
neomLogger.t("readServiceAccount (allowClientServiceAccount=$allowClient, debug=$kDebugMode)");
try {
String jsonString = await rootBundle.loadString(DataAssets.serviceAccountJsonPath);
serviceAccount = jsonDecode(jsonString);
neomLogger.t("Service Account Loaded (${(serviceAccount as Map).length} keys)");
} catch (e, st) {
NeomErrorLogger.recordError(e, st, module: 'neom_core', operation: 'readServiceAccount');
return;
}
}