diff --git a/web/repertory/lib/helpers.dart b/web/repertory/lib/helpers.dart index 24264bf6..8480d7ff 100644 --- a/web/repertory/lib/helpers.dart +++ b/web/repertory/lib/helpers.dart @@ -235,41 +235,45 @@ bool validateSettings( } Future> convertAllToString( - Map settings, { - String? password, -}) async { - for (var entry in settings.entries) { - if (entry.value is Map) { - convertAllToString(entry.value, password: password); - continue; - } - - if (entry.key == 'ApiPassword' || - entry.key == 'EncryptionToken' || - entry.key == 'SecretKey') { - if (entry.value.isEmpty) { + Map settings, +) async { + String? password; + Future> convert(Map settings) async { + for (var entry in settings.entries) { + if (entry.value is Map) { + convert(entry.value); continue; } - if (password == null) { - password = await promptPassword(); - if (password == null) { - throw NullPasswordException(); + if (entry.key == 'ApiPassword' || + entry.key == 'EncryptionToken' || + entry.key == 'SecretKey') { + if (entry.value.isEmpty) { + continue; } + + if (password == null) { + password = await promptPassword(); + if (password == null) { + throw NullPasswordException(); + } + } + + settings[entry.key] = encryptValue(entry.value, password!); + continue; } - settings[entry.key] = encryptValue(entry.value, password); - continue; + if (entry.value is String) { + continue; + } + + settings[entry.key] = entry.value.toString(); } - if (entry.value is String) { - continue; - } - - settings[entry.key] = entry.value.toString(); + return settings; } - return settings; + return await convert(settings); } String encryptValue(String value, String password) {