-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add switch to control notification #2869 * feat: Fix notification issue and make chat only custom * Update notification room #2875 * feat: Move notification menu to differnt place #2869 * refactor: Update notification switch location #2869 * Issue with name.firstname, cf slack #2880 * feat: Consider more constrainsts for presentation #2882 * feat: Consider more constrainsts for presentation #2882 * version update: 2.12.6+511 * Update notification UI * feat: Add switch to control notification #2869 * refactor: Update notification switch location #2869 * feat: Add 10 sec timeout for keys and verification fetch #2917 * feat: Implement activity log #2895 * feat: Show default activity log ON #2926 * feat: Manage notification data #2927 * refactor: Update date format in activity log #2927 * feat: Update hiap call * version update: 2.14.2+521 * refactor: Add seconds #2932 * feat: Update image for notification #2929 * feat: Add verifier domain name #2927 * feat: Name etherlink correctly #2936 * feat: Add email and website link click in notification #2928 * version update: 2.14.3+522 * refactor: Update tests * feat: Remove kid to pass signature check #2945 * feat: Add activity domain name #2927 * feat: Remove nft and coins for discover for altme #2940 * feat: Update wallet metadata for issuers #2941 --------- Co-authored-by: Bibash Shrestha <[email protected]>
- Loading branch information
Showing
47 changed files
with
790 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export 'activity_log_manager.dart'; | ||
export 'log_class.dart'; | ||
export 'log_enum.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:altme/activity_log/activity_log.dart'; | ||
import 'package:secure_storage/secure_storage.dart'; | ||
|
||
class ActivityLogManager { | ||
ActivityLogManager(SecureStorageProvider secureStorageProvider) | ||
: _secureStorageProvider = secureStorageProvider; | ||
|
||
final SecureStorageProvider _secureStorageProvider; | ||
|
||
static const int maxLogsPerBatch = 100; | ||
|
||
/// Get logs from single batch | ||
Future<List<LogData>> _getLogsForCurrentBatch(int index) async { | ||
final logDataJson = await _secureStorageProvider.get('log_batch_$index'); | ||
|
||
if (logDataJson != null) { | ||
final logStrings = logDataJson.split('\n'); | ||
return logStrings | ||
.map( | ||
(logString) => LogData.fromJson( | ||
jsonDecode(logString) as Map<String, dynamic>, | ||
), | ||
) | ||
.toList(); | ||
} | ||
return []; | ||
} | ||
|
||
/// Set log entry | ||
Future<void> saveLog(LogData log) async { | ||
final currentBatchIndex = await _getCurrentBatchIndex(); | ||
|
||
List<LogData> logs = await _getLogsForCurrentBatch(currentBatchIndex); | ||
|
||
// If the batch is full, increment the batch index and start a new batch | ||
if (logs.length >= maxLogsPerBatch) { | ||
await _incrementBatchIndex(); | ||
logs = []; | ||
} | ||
|
||
logs.add(log); | ||
|
||
final logJsonList = logs.map((log) => jsonEncode(log.toJson())).toList(); | ||
|
||
await _secureStorageProvider.set( | ||
'log_batch_$currentBatchIndex', | ||
logJsonList.join('\n'), | ||
); | ||
} | ||
|
||
/// Get logs from all batches | ||
Future<List<LogData>> readAllLogs() async { | ||
final currentBatchIndex = await _getCurrentBatchIndex(); | ||
final allLogs = <LogData>[]; | ||
|
||
for (int i = currentBatchIndex; i == 0; i--) { | ||
final logData = await _getLogsForCurrentBatch(i); | ||
allLogs.addAll(logData.reversed.toList()); | ||
} | ||
return allLogs; | ||
} | ||
|
||
// /// Get paginated logs | ||
// Future<List<LogData>> readLogs(int limit, int offset) async { | ||
// final allLogs = <LogData>[]; | ||
|
||
// final currentBatchIndex = await _getCurrentBatchIndex(); | ||
// // Retrieve logs from all batches | ||
// for (int i = 0; i <= currentBatchIndex; i++) { | ||
// final logData = await _secureStorageProvider.get('log_batch_$i'); | ||
// if (logData != null) { | ||
// final logStrings = logData.split('\n'); | ||
// final logs = logStrings | ||
// .map( | ||
// (logString) => LogData.fromJson( | ||
// jsonDecode(logString) as Map<String, dynamic>, | ||
// ), | ||
// ) | ||
// .toList(); | ||
// allLogs.addAll(logs); | ||
// } | ||
// } | ||
|
||
// // Apply pagination logic (limit and offset) | ||
// // but this logic needs to be improved.. it is paginating later.. | ||
// // we need to consider while fetching | ||
// return allLogs.skip(offset).take(limit).toList(); | ||
// } | ||
|
||
/// Clear all logs | ||
Future<void> clearLogs() async { | ||
final currentBatchIndex = await _getCurrentBatchIndex(); | ||
for (int i = 0; i <= currentBatchIndex; i++) { | ||
await _secureStorageProvider.delete('log_batch_$i'); | ||
} | ||
await _secureStorageProvider.delete('currentBatchIndex'); | ||
} | ||
|
||
/// get Current Batch | ||
Future<int> _getCurrentBatchIndex() async { | ||
final index = await _secureStorageProvider.get('currentBatchIndex'); | ||
if (index != null) { | ||
return int.parse(index); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
Future<void> _incrementBatchIndex() async { | ||
final currentBatchIndex = await _getCurrentBatchIndex(); | ||
final newBatchIndex = currentBatchIndex + 1; | ||
await _secureStorageProvider.set( | ||
'currentBatchIndex', | ||
newBatchIndex.toString(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:altme/activity_log/activity_log.dart'; | ||
import 'package:altme/app/app.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'log_class.g.dart'; | ||
|
||
@JsonSerializable() | ||
class LogData extends Equatable { | ||
LogData({ | ||
required this.type, | ||
DateTime? timestamp, | ||
this.vcInfo, | ||
}) : timestamp = timestamp ?? DateTime.now(); | ||
|
||
factory LogData.fromJson(Map<String, dynamic> json) => | ||
_$LogDataFromJson(json); | ||
|
||
final LogType type; | ||
final DateTime timestamp; | ||
final VCInfo? vcInfo; | ||
|
||
Map<String, dynamic> toJson() => _$LogDataToJson(this); | ||
|
||
@override | ||
List<Object?> get props => [ | ||
type, | ||
timestamp, | ||
vcInfo, | ||
]; | ||
} | ||
|
||
@JsonSerializable() | ||
class VCInfo extends Equatable { | ||
const VCInfo({ | ||
required this.id, | ||
required this.name, | ||
this.domain, | ||
}); | ||
|
||
factory VCInfo.fromJson(Map<String, dynamic> json) => _$VCInfoFromJson(json); | ||
|
||
final String id; | ||
final String name; | ||
final String? domain; | ||
|
||
Map<String, dynamic> toJson() => _$VCInfoToJson(this); | ||
|
||
@override | ||
List<Object?> get props => [ | ||
id, | ||
name, | ||
domain, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
enum LogType { | ||
walletInit, | ||
backupData, | ||
restoreWallet, | ||
addVC, | ||
deleteVC, | ||
presentVC, | ||
importKey, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -305,26 +305,26 @@ abstract class ConstantsJson { | |
static const walletMetadataForIssuers = <String, dynamic>{ | ||
'vp_formats_supported': { | ||
'jwt_vp': { | ||
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'], | ||
'alg': ['ES256', 'ES256K', 'EdDSA'], | ||
}, | ||
'jwt_vc': { | ||
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'], | ||
'alg': ['ES256', 'ES256K', 'EdDSA'], | ||
}, | ||
'jwt_vp_json': { | ||
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'], | ||
'alg': ['ES256', 'ES256K', 'EdDSA'], | ||
}, | ||
'jwt_vc_json': { | ||
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'], | ||
'alg': ['ES256', 'ES256K', 'EdDSA'], | ||
}, | ||
'vc+sd-jwt': { | ||
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'], | ||
'alg': ['ES256', 'ES256K', 'EdDSA'], | ||
}, | ||
'ldp_vp': { | ||
'proof_type': [ | ||
'JsonWebSignature2020', | ||
'Ed25519Signature2018', | ||
'EcdsaSecp256k1Signature2019', | ||
'RsaSignature2018', | ||
'RsaSignature2018' | ||
], | ||
}, | ||
'ldp_vc': { | ||
|
@@ -337,24 +337,21 @@ abstract class ConstantsJson { | |
}, | ||
}, | ||
'grant_types': ['authorization code', 'pre-authorized_code'], | ||
'redirect_uris': [Parameters.redirectUri], | ||
'redirect_uris': [Parameters.authorizationEndPoint], | ||
'subject_syntax_types_supported': ['did:key', 'did:jwk'], | ||
'subject_syntax_types_discriminations': [ | ||
'did:key:jwk_jcs-pub', | ||
'did:ebsi:v1', | ||
], | ||
'response_types_supported': ['vp_token', 'id_token'], | ||
'token_endpoint_auth_method_supported': [ | ||
'none', | ||
'client_id', | ||
'client_secret_post', | ||
'client_secret_basic', | ||
'client_secret_jwt', | ||
], | ||
'credential_offer_endpoint_supported': [ | ||
'openid-credential-offer://', | ||
'haip://', | ||
], | ||
'credential_offer_endpoint': ['openid-credential-offer://', 'haip://'], | ||
'client_name': '${Parameters.appName} wallet', | ||
'contacts': ['[email protected]'], | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'cubit/activity_log_cubit.dart'; | ||
export 'view/activity_log_page.dart'; |
Oops, something went wrong.