Refactor RollingCodesService to remove configuration file handling and update initialization logic

This commit is contained in:
ImBenji
2025-08-19 21:06:41 +01:00
parent 17091bcc95
commit 4a7fec9711
3 changed files with 13 additions and 57 deletions

View File

@@ -9,11 +9,7 @@ class ServerService {
static Future<void> registerServer() async {
await RollingCodesService.initialize();
// If already registered and has operational seed, skip registration
if (RollingCodesService.isRegistered) {
print('Server already registered with operational seed');
return;
}
// Server always registers on startup to get fresh operational seed
GeolocationData geolocationData = await getGeolocationData();
@@ -50,8 +46,8 @@ class ServerService {
if (response.statusCode == 200) {
final responseData = jsonDecode(response.body);
if (responseData['success']) {
// Store operational seed
await RollingCodesService.setOperationalSeed(responseData['operational_seed']);
// Store operational seed in memory (no persistence needed)
RollingCodesService.setOperationalSeed(responseData['operational_seed']);
print('Server registered successfully with server-manager');
} else {
throw Exception('Registration failed: ${responseData['error']}');