dart format
This commit is contained in:
@@ -34,11 +34,16 @@ class AccountData {
|
||||
return _password!;
|
||||
}
|
||||
|
||||
String getUserSecret() =>
|
||||
sha512.convert(utf8.encode('${getUsername()}:${getPassword()}')).toString();
|
||||
String getUserSecret() => sha512
|
||||
.convert(utf8.encode('${getUsername()}:${getPassword()}'))
|
||||
.toString();
|
||||
|
||||
Future<String> getDeviceId() async => sha512
|
||||
.convert(utf8.encode('${getUserSecret()}@${await FirebaseMessaging.instance.getToken()}'))
|
||||
.convert(
|
||||
utf8.encode(
|
||||
'${getUserSecret()}@${await FirebaseMessaging.instance.getToken()}',
|
||||
),
|
||||
)
|
||||
.toString();
|
||||
|
||||
Future<void> setData(String username, String password) async {
|
||||
@@ -92,7 +97,11 @@ class AccountData {
|
||||
/// Prefer this over embedding credentials in URLs — error logs and crash
|
||||
/// reports often capture the URL but not headers.
|
||||
String getBasicAuthHeader() {
|
||||
if (!isPopulated()) throw Exception('AccountData (e.g. username or password) is not initialized!');
|
||||
if (!isPopulated()) {
|
||||
throw Exception(
|
||||
'AccountData (e.g. username or password) is not initialized!',
|
||||
);
|
||||
}
|
||||
return 'Basic ${base64Encode(utf8.encode('$_username:$_password'))}';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user