Start writing the web app
All checks were successful
ci/woodpecker/push/build Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
This commit was merged in pull request #5.
This commit is contained in:
2026-05-19 13:37:41 +02:00
parent 0c5b657a2f
commit 09df205fdb
76 changed files with 1961 additions and 117 deletions

View File

@@ -0,0 +1,42 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
const accessTokenKey = "access_token";
const refreshTokenKey = "refresh_token";
final tokenStorageRepositoryProvider = Provider<TokenStorageRepository>((ref) {
return TokenStorageRepository();
});
// Secure storage backend for storing tokens in the browser
class TokenStorageRepository {
static const _storage = FlutterSecureStorage();
TokenStorageRepository();
// Store the refresh token in the storage
Future<void> storeRefreshToken(String token) async {
await _storage.write(key: refreshTokenKey, value: token);
}
// Store the access token in the storage
Future<void> storeAccessToken(String token) async {
await _storage.write(key: accessTokenKey, value: token);
}
// Get the acccess token from the storage
Future<String?> getAccessToken() async {
final token = await _storage.read(key: accessTokenKey);
return token;
}
// Get the refresh token from the storage
Future<String?> getRefreshToken() async {
final token = await _storage.read(key: refreshTokenKey);
return token;
}
Future<void> clearStorage() async {
await _storage.delete(key: refreshTokenKey);
await _storage.delete(key: accessTokenKey);
}
}