Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
677 B

import 'package:shared_preferences/shared_preferences.dart';
const sessionCookieName = 'sessionCookie';
void setSessionCookie(String cookie) async {
final prefs = await SharedPreferences.getInstance();
prefs.setString(sessionCookieName, cookie);
}
void unsetSessionCookie() async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove(sessionCookieName);
}
Future<String> getSessionCookie() async {
final prefs = await SharedPreferences.getInstance();
String? sessionCookie = prefs.getString(sessionCookieName);
if (sessionCookie == null) {
throw Exception('No session cookie set');
}
return sessionCookie;
}