From e6531bff7cc91f556a170cc696e79e91687952e1 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 13 May 2025 10:07:25 +0100 Subject: [PATCH] fix: login state closes #11 --- lib/login.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/login.dart b/lib/login.dart index 297d9e9..7ffc147 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -53,9 +53,11 @@ class LoginAccount { if ((json["pubKey"] as String).length != 64) { throw "Invalid pubkey, length != 64"; } - if (json.containsKey("privateKey") && - (json["privateKey"] as String).length != 64) { - throw "Invalid privateKey, length != 64"; + if (json.containsKey("privateKey")) { + final privKey = json["privateKey"] as String?; + if (privKey != null && privKey.length != 64) { + throw "Invalid privateKey, length != 64"; + } } return LoginAccount._( type: AccountType.values.firstWhere(