fix: login state

closes #11
This commit is contained in:
2025-05-13 10:07:25 +01:00
parent 3e672f9e28
commit e6531bff7c

View File

@ -53,10 +53,12 @@ class LoginAccount {
if ((json["pubKey"] as String).length != 64) { if ((json["pubKey"] as String).length != 64) {
throw "Invalid pubkey, length != 64"; throw "Invalid pubkey, length != 64";
} }
if (json.containsKey("privateKey") && if (json.containsKey("privateKey")) {
(json["privateKey"] as String).length != 64) { final privKey = json["privateKey"] as String?;
if (privKey != null && privKey.length != 64) {
throw "Invalid privateKey, length != 64"; throw "Invalid privateKey, length != 64";
} }
}
return LoginAccount._( return LoginAccount._(
type: AccountType.values.firstWhere( type: AccountType.values.firstWhere(
(v) => v.toString().endsWith(json["type"] as String), (v) => v.toString().endsWith(json["type"] as String),