Apply autofixes

This commit is contained in:
zontreck 2024-05-15 15:54:13 -07:00
parent 7c358d48e0
commit 10d7b8be65
5 changed files with 49 additions and 45 deletions

View file

@ -17,22 +17,22 @@ enum APIEndpoint {
String getURL() {
Settings settings = Settings();
return "${settings.API_SERVER}${path}${script}";
return "${settings.API_SERVER}$path$script";
}
}
enum HTTPMethod { Get, Post, Put, Delete }
class Settings {
static Settings? _inst = null;
Settings._() {}
static Settings? _inst;
Settings._();
Dio dio = Dio();
factory Settings() {
if (Settings._inst != null)
if (Settings._inst != null) {
return Settings._inst!;
else {
} else {
Settings._inst = Settings._();
return Settings._inst!;
}
@ -56,13 +56,13 @@ class Settings {
var port = js['api']['port'] as int;
var host = js['api']['host'] as String;
API_SERVER = "${protocol}://${host}:${port}/";
API_SERVER = "$protocol://$host:$port/";
}
Future<String> hashPSK(String PSK) async {
String hash = Hashing.md5Hash("AriasCreations");
for (int i = 0; i < 8192; i++) {
hash = Hashing.sha256Hash("${hash}:${PSK}");
hash = Hashing.sha256Hash("$hash:$PSK");
}
hash = Hashing.sha256Hash(hash);
@ -70,8 +70,8 @@ class Settings {
}
Future<String> createDerivedPSK(String hashedPSK, String purpose) async {
String hash = await hashPSK("${hashedPSK}:${purpose}");
return await hashPSK("${hash}:${hashedPSK}:${purpose}"); // The derived PSK
String hash = await hashPSK("$hashedPSK:$purpose");
return await hashPSK("$hash:$hashedPSK:$purpose"); // The derived PSK
}
Future<IPacket> sendPacketToEndpoint(