fix: some problems are fixed
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
/// ذخیرهی امن توکن JWT.
|
||||
/// ذخیرهی امن توکن JWT و شمارهی موبایلِ کاربر.
|
||||
class TokenStorage {
|
||||
static const _key = 'jwt_token';
|
||||
static const _mobileKey = 'user_mobile';
|
||||
final FlutterSecureStorage _storage;
|
||||
|
||||
TokenStorage([FlutterSecureStorage? storage])
|
||||
@@ -12,5 +13,13 @@ class TokenStorage {
|
||||
|
||||
Future<void> write(String token) => _storage.write(key: _key, value: token);
|
||||
|
||||
Future<void> clear() => _storage.delete(key: _key);
|
||||
Future<String?> readMobile() => _storage.read(key: _mobileKey);
|
||||
|
||||
Future<void> writeMobile(String mobile) =>
|
||||
_storage.write(key: _mobileKey, value: mobile);
|
||||
|
||||
Future<void> clear() async {
|
||||
await _storage.delete(key: _key);
|
||||
await _storage.delete(key: _mobileKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user