From 80c58ca0c9569ac45af6782642f8cba53a5d4e2c Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Mon, 27 Nov 2023 20:06:21 +0545 Subject: [PATCH] October (#2131) * feat: Use didkey instead of random string and change parameter #2122 * feat: Fixed deffered credential issue * refactor: Get rid of unecessary check for deferred credential * refactor: Get rid of unecessary check for deferred credential * version update * revert release from launch.json --- .../profile/cubit/profile_cubit.dart | 6 +-- .../cubit/qr_code_scan_cubit.dart | 50 ++++++++----------- pubspec.yaml | 2 +- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/lib/dashboard/profile/cubit/profile_cubit.dart b/lib/dashboard/profile/cubit/profile_cubit.dart index 01b894831..fb8e82e55 100644 --- a/lib/dashboard/profile/cubit/profile_cubit.dart +++ b/lib/dashboard/profile/cubit/profile_cubit.dart @@ -445,11 +445,10 @@ class ProfileCubit extends Cubit { ); final ebsiV3Profile = ProfileModel.EbsiV3(); final profileModel = state.model.copyWith( - isDeveloperMode: ebsiV3Profile.isDeveloperMode, isEbsiV3Profile: enabled, enableSecurity: ebsiV3Profile.enableSecurity, enable4DigitPINCode: ebsiV3Profile.enable4DigitPINCode, - enableJWKThumbprint: ebsiV3Profile.enable4DigitPINCode, + enableJWKThumbprint: ebsiV3Profile.enableJWKThumbprint, enableCryptographicHolderBinding: ebsiV3Profile.enableCryptographicHolderBinding, didKeyType: ebsiV3Profile.didKeyType, @@ -466,11 +465,10 @@ class ProfileCubit extends Cubit { json.decode(customProfileBackupValue) as Map, ); final profileModel = state.model.copyWith( - isDeveloperMode: customProfileBackup.isDeveloperMode, isEbsiV3Profile: enabled, enableSecurity: customProfileBackup.enableSecurity, enable4DigitPINCode: customProfileBackup.enable4DigitPINCode, - enableJWKThumbprint: customProfileBackup.enable4DigitPINCode, + enableJWKThumbprint: customProfileBackup.enableJWKThumbprint, enableCryptographicHolderBinding: customProfileBackup.enableCryptographicHolderBinding, didKeyType: customProfileBackup.didKeyType, diff --git a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart index 47305956b..faa158284 100644 --- a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart +++ b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart @@ -23,7 +23,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:jwt_decode/jwt_decode.dart'; import 'package:oidc4vc/oidc4vc.dart'; import 'package:secure_storage/secure_storage.dart'; -import 'package:uuid/uuid.dart'; part 'qr_code_scan_cubit.g.dart'; part 'qr_code_scan_state.dart'; @@ -717,10 +716,8 @@ class QRCodeScanCubit extends Cubit { final url = credentialModel.pendingInfo!.url; - OIDC4VCType? currentOIIDC4VCTypeForIssuance; - final ( - OIDC4VCType? oidc4vcType, + _, Map? openidConfigurationResponse, Map? authorizationServerConfiguration, _, @@ -729,8 +726,6 @@ class QRCodeScanCubit extends Cubit { client: client, ); - currentOIIDC4VCTypeForIssuance = oidc4vcType; - if (openidConfigurationResponse != null) { await handleErrorForOID4VCI( url: url, @@ -739,28 +734,12 @@ class QRCodeScanCubit extends Cubit { ); } - if (currentOIIDC4VCTypeForIssuance != null) { - await getAndAddDefferedCredential( - credentialModel: credentialModel, - credentialsCubit: credentialsCubit, - dioClient: client, - oidc4vc: oidc4vc, - ); - } else if (credentialModel.pendingInfo!.url - .startsWith(Parameters.authorizeEndPoint)) { - await getAndAddDefferedCredential( - credentialModel: credentialModel, - credentialsCubit: credentialsCubit, - dioClient: client, - oidc4vc: oidc4vc, - ); - } else { - emitError( - ResponseMessage( - message: ResponseString.RESPONSE_STRING_thisRequestIsNotSupported, - ), - ); - } + await getAndAddDefferedCredential( + credentialModel: credentialModel, + credentialsCubit: credentialsCubit, + dioClient: client, + oidc4vc: oidc4vc, + ); } catch (e) { emitError(e); } @@ -1094,7 +1073,20 @@ class QRCodeScanCubit extends Cubit { clientId = profileCubit.state.model.clientId; clientSecret = profileCubit.state.model.clientSecret; } else { - clientId = const Uuid().v4(); + final privateKey = await fetchPrivateKey( + oidc4vc: oidc4vc, + secureStorage: secureStorageProvider, + isEBSIV3: isEBSIV3, + ); + + final (did, _) = await fetchDidAndKid( + privateKey: privateKey, + isEBSIV3: isEBSIV3, + didKitProvider: didKitProvider, + secureStorage: secureStorageProvider, + ); + clientId = did; + //clientId = const Uuid().v4(); } await getAuthorizationUriForIssuer( diff --git a/pubspec.yaml b/pubspec.yaml index 5f8427b66..d66cb04ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: altme description: AltMe Flutter App -version: 1.25.0+321 +version: 1.25.2+322 environment: sdk: ">=3.1.0 <4.0.0"