+signup +login
Some checks failed
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed

This commit is contained in:
Stephan D
2025-11-17 20:16:45 +01:00
parent 1ab7f2e7d3
commit c6a56071b5
89 changed files with 1308 additions and 3497 deletions

View File

@@ -20,6 +20,34 @@ class AuthorizationStorage {
return TokenData.fromJson(jsonDecode(tokenJson));
}
static Future<bool> _checkTokenUsable(String keyName) async {
final hasKey = await SecureStorageService.containsKey(keyName);
if (!hasKey) return false;
try {
final tokenData = await _getTokenData(keyName);
return tokenData.expiration.isAfter(DateTime.now());
} catch (e, st) {
_logger.warning('Error reading token from $keyName: $e', e, st);
rethrow;
}
}
static Future<bool> isAuthorizationStored() async {
_logger.fine('Checking if authorization is stored');
final accessUsable = await _checkTokenUsable(Constants.accessTokenStorageKey);
if (accessUsable) return true;
final refreshUsable = await _checkTokenUsable(Constants.refreshTokenStorageKey);
if (refreshUsable) return true;
return false;
}
static Future<TokenData> getAccessToken() async {
_logger.fine('Getting access token');
return _getTokenData(Constants.accessTokenStorageKey);