Skip to content

Colota - Android GPS Location tracker

remove endpoint from encrypted storage, keep in SQLite only

Max Dietrich394fedd5119a
diff --git a/android/app/src/main/java/com/colota/BootReceiver.kt b/android/app/src/main/java/com/colota/BootReceiver.kt
index 92202759..b967d6bb 100644
--- a/android/app/src/main/java/com/colota/BootReceiver.kt
+++ b/android/app/src/main/java/com/colota/BootReceiver.kt
@@ -99,13 +99,7 @@ class LocationBootReceiver : BroadcastReceiver() {
}
// Load config using ServiceConfig (eliminates duplication)
- var config = ServiceConfig.fromDatabase(dbHelper)
-
- // Override endpoint from encrypted storage if available
- val secureEndpoint = SecureStorageHelper.getInstance(context).getEndpoint()
- if (!secureEndpoint.isNullOrBlank()) {
- config = config.copy(endpoint = secureEndpoint)
- }
+ val config = ServiceConfig.fromDatabase(dbHelper)
// Create service intent with config
val serviceIntent = Intent(context, LocationForegroundService::class.java)
diff --git a/android/app/src/main/java/com/colota/LocationForegroundService.kt b/android/app/src/main/java/com/colota/LocationForegroundService.kt
index 460273ff..0c46fa16 100644
--- a/android/app/src/main/java/com/colota/LocationForegroundService.kt
+++ b/android/app/src/main/java/com/colota/LocationForegroundService.kt
@@ -876,12 +876,6 @@ class LocationForegroundService : Service() {
ServiceConfig.fromDatabase(dbHelper)
}
- // Override endpoint from encrypted storage if available
- val secureEndpoint = secureStorage.getEndpoint()
- if (!secureEndpoint.isNullOrBlank()) {
- config = config.copy(endpoint = secureEndpoint)
- }
-
// Load auth headers from encrypted storage
authHeaders = secureStorage.getAuthHeaders()
diff --git a/android/app/src/main/java/com/colota/LocationServiceModule.kt b/android/app/src/main/java/com/colota/LocationServiceModule.kt
index faf545cb..33796d79 100644
--- a/android/app/src/main/java/com/colota/LocationServiceModule.kt
+++ b/android/app/src/main/java/com/colota/LocationServiceModule.kt
@@ -585,7 +585,6 @@ class LocationServiceModule(reactContext: ReactApplicationContext) :
putString("username", secureStorage.getString(SecureStorageHelper.KEY_USERNAME, ""))
putString("password", secureStorage.getString(SecureStorageHelper.KEY_PASSWORD, ""))
putString("bearerToken", secureStorage.getString(SecureStorageHelper.KEY_BEARER_TOKEN, ""))
- putString("endpoint", secureStorage.getString(SecureStorageHelper.KEY_ENDPOINT, ""))
putString("customHeaders", secureStorage.getString(SecureStorageHelper.KEY_CUSTOM_HEADERS, "{}"))
}
}
@@ -604,9 +603,6 @@ class LocationServiceModule(reactContext: ReactApplicationContext) :
config.getString("bearerToken")?.let {
secureStorage.putString(SecureStorageHelper.KEY_BEARER_TOKEN, it)
}
- config.getString("endpoint")?.let {
- secureStorage.putString(SecureStorageHelper.KEY_ENDPOINT, it)
- }
config.getString("customHeaders")?.let {
secureStorage.putString(SecureStorageHelper.KEY_CUSTOM_HEADERS, it)
}
diff --git a/android/app/src/main/java/com/colota/SecureStorageHelper.kt b/android/app/src/main/java/com/colota/SecureStorageHelper.kt
index a918b4f5..d36aebf5 100644
--- a/android/app/src/main/java/com/colota/SecureStorageHelper.kt
+++ b/android/app/src/main/java/com/colota/SecureStorageHelper.kt
@@ -15,7 +15,7 @@ import org.json.JSONObject
/**
* Singleton wrapper around EncryptedSharedPreferences for storing
- * sensitive connection data (credentials, tokens, headers, endpoint).
+ * sensitive connection data (credentials, tokens, custom headers).
*/
class SecureStorageHelper private constructor(context: Context) {
@@ -27,7 +27,6 @@ class SecureStorageHelper private constructor(context: Context) {
const val KEY_USERNAME = "auth_username"
const val KEY_PASSWORD = "auth_password"
const val KEY_BEARER_TOKEN = "auth_bearer_token"
- const val KEY_ENDPOINT = "endpoint"
const val KEY_CUSTOM_HEADERS = "custom_headers"
@Volatile
@@ -114,6 +113,4 @@ class SecureStorageHelper private constructor(context: Context) {
return headers
}
-
- fun getEndpoint(): String? = getString(KEY_ENDPOINT, null)
}
diff --git a/src/screens/AuthSettingsScreen.tsx b/src/screens/AuthSettingsScreen.tsx
index 3641b230..4f8d64cd 100644
--- a/src/screens/AuthSettingsScreen.tsx
+++ b/src/screens/AuthSettingsScreen.tsx
@@ -405,7 +405,7 @@ export function AuthSettingsScreen({}: ScreenProps) {
{/* Footer */}
<View style={styles.footer}>
<Text style={[styles.footerText, { color: colors.textLight }]}>
- Credentials are stored encrypted on device
+ Credentials and headers are stored encrypted on device
</Text>
</View>
</ScrollView>
diff --git a/src/screens/SettingsScreen.tsx b/src/screens/SettingsScreen.tsx
index d1911a56..73df132d 100644
--- a/src/screens/SettingsScreen.tsx
+++ b/src/screens/SettingsScreen.tsx
@@ -146,16 +146,6 @@ export function SettingsScreen({ navigation }: ScreenProps) {
await setSettings(newSettings);
await restartTracking(newSettings);
- // Sync endpoint to encrypted storage
- if (newSettings.endpoint) {
- NativeLocationService.getAuthConfig().then((authConfig) => {
- NativeLocationService.saveAuthConfig({
- ...authConfig,
- endpoint: newSettings.endpoint,
- });
- });
- }
-
setSaveSuccess(true);
setTimeout(() => setSaveSuccess(false), 2000);
} catch (err) {
diff --git a/src/services/NativeLocationService.ts b/src/services/NativeLocationService.ts
index c238e975..94e48726 100644
--- a/src/services/NativeLocationService.ts
+++ b/src/services/NativeLocationService.ts
@@ -585,7 +585,6 @@ class NativeLocationService {
username: raw.username || "",
password: raw.password || "",
bearerToken: raw.bearerToken || "",
- endpoint: raw.endpoint || "",
customHeaders: raw.customHeaders ? JSON.parse(raw.customHeaders) : {},
};
}
@@ -600,7 +599,6 @@ class NativeLocationService {
username: config.username,
password: config.password,
bearerToken: config.bearerToken,
- endpoint: config.endpoint,
customHeaders: JSON.stringify(config.customHeaders),
});
}
diff --git a/src/types/global.ts b/src/types/global.ts
index dfd51bd4..e3334c25 100644
--- a/src/types/global.ts
+++ b/src/types/global.ts
@@ -246,7 +246,6 @@ export interface AuthConfig {
username: string;
password: string;
bearerToken: string;
- endpoint: string;
customHeaders: Record<string, string>;
}
@@ -255,7 +254,6 @@ export const DEFAULT_AUTH_CONFIG: AuthConfig = {
username: "",
password: "",
bearerToken: "",
- endpoint: "",
customHeaders: {},
};