Fix #23: JWT storage consistency across all Flutter apps
- siro_admin: added FlutterSecureStorage write alongside GetStorage - siro_service: added FlutterSecureStorage write in login + guest JWT flows - siro_rider: added FlutterSecureStorage write in guest + token-refresh flows (full-credential login already wrote to both) - siro_driver: already wrote to both (no change needed) - All apps now write JWT to both GetStorage and FlutterSecureStorage
This commit is contained in:
@@ -48,6 +48,7 @@ class CRUD {
|
|||||||
final jwt = decodedResponse1['jwt'];
|
final jwt = decodedResponse1['jwt'];
|
||||||
Log.print('jwt: ${jwt}');
|
Log.print('jwt: ${jwt}');
|
||||||
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
|
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
|
||||||
|
await storage.write(key: BoxName.jwt, value: X.c(X.c(X.c(jwt, cn), cC), cs));
|
||||||
// await AppInitializer().getKey();
|
// await AppInitializer().getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ class LoginController extends GetxController {
|
|||||||
if (jwt != null) {
|
if (jwt != null) {
|
||||||
// نشفر الـ JWT بالتشفير الثلاثي قبل التخزين في GetStorage
|
// نشفر الـ JWT بالتشفير الثلاثي قبل التخزين في GetStorage
|
||||||
box.write(BoxName.jwt, c(jwt));
|
box.write(BoxName.jwt, c(jwt));
|
||||||
|
storage.write(key: BoxName.jwt, value: c(jwt));
|
||||||
}
|
}
|
||||||
|
|
||||||
await EncryptionHelper.initialize();
|
await EncryptionHelper.initialize();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ── مستخدم موجود: تجديد التوكن ────────────────────────
|
// ── مستخدم موجود: تجديد التوكن
|
||||||
await EncryptionHelper.initialize();
|
|
||||||
|
|
||||||
var payload = {
|
var payload = {
|
||||||
'id': box.read(BoxName.passengerID),
|
'id': box.read(BoxName.passengerID),
|
||||||
@@ -158,6 +158,7 @@ class LoginController extends GetxController {
|
|||||||
|
|
||||||
if (jwt != null) {
|
if (jwt != null) {
|
||||||
box.write(BoxName.jwt, c(jwt));
|
box.write(BoxName.jwt, c(jwt));
|
||||||
|
storage.write(key: BoxName.jwt, value: c(jwt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,6 +297,7 @@ class CRUD {
|
|||||||
Log.print('hmac_key: $hmac');
|
Log.print('hmac_key: $hmac');
|
||||||
|
|
||||||
await box.write(BoxName.jwt, c(jwt));
|
await box.write(BoxName.jwt, c(jwt));
|
||||||
|
await storage.write(key: BoxName.jwt, value: c(jwt));
|
||||||
if (hmac != null) {
|
if (hmac != null) {
|
||||||
await box.write(BoxName.hmac, hmac);
|
await box.write(BoxName.hmac, hmac);
|
||||||
final verify = box.read(BoxName.hmac);
|
final verify = box.read(BoxName.hmac);
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class LoginController extends GetxController {
|
|||||||
final jwt = loginData['jwt'];
|
final jwt = loginData['jwt'];
|
||||||
final hmac = loginData['hmac'];
|
final hmac = loginData['hmac'];
|
||||||
await box.write(BoxName.jwt, c(jwt));
|
await box.write(BoxName.jwt, c(jwt));
|
||||||
|
await storage.write(key: BoxName.jwt, value: c(jwt));
|
||||||
if (hmac != null) {
|
if (hmac != null) {
|
||||||
await box.write(BoxName.hmac, hmac);
|
await box.write(BoxName.hmac, hmac);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user