Skip to content

Commit

Permalink
delete old records
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed May 17, 2024
1 parent 193d3d2 commit 77a3a5f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,12 @@ class OIDC4VC {
try {
final secureStorageProvider = getSecureStorage;
final cachedData = await secureStorageProvider.get(uri);
// TODO(hawkbee): To be removed.
/// temporary solution to purge faulty stored data
/// Will be removed in the future
await purgeFaultyStorageEntries(secureStorageProvider, uri);

/// end of temporary solution
dynamic response;

dio.options.headers = headers;
Expand Down Expand Up @@ -1759,6 +1765,20 @@ class OIDC4VC {
}
}

// TODO(hawkbee): To be removed.
Future<void> purgeFaultyStorageEntries(
SecureStorageProvider secureStorageProvider, String uri) async {
// get all entries from the storage
final entries = await secureStorageProvider.getAllValues();
// remove all entries that do not start with the https://
for (final entry in entries.entries) {
if (!entry.key.startsWith('https://')) {
await secureStorageProvider.delete(entry.key);
print(entry.key + ' deleted');
}
}
}

Map<String, dynamic> publicKeyBase58ToPublicJwk(String publicKeyBase58) {
///step 1 : change the publicKeyBase58 format from base58 to base64 :
///decode base58 then encode in base64 urlsafe
Expand Down

0 comments on commit 77a3a5f

Please sign in to comment.