From 5da4e0a86430c77cd84fec301c01537bd0640a66 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 16:01:40 +0545 Subject: [PATCH 1/6] feat: Draft 13, authorization code flow fails with scope #2388 --- packages/oidc4vc/lib/src/oidc4vc.dart | 90 +++++++++++++++++++-------- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index ca5bf54e7..beade19c7 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -203,38 +203,78 @@ class OIDC4VC { for (final credential in selectedCredentials) { late Map data; if (credential is String) { - // - final credentialsSupported = openIdConfiguration.credentialsSupported; + if (openIdConfiguration.credentialsSupported != null) { + final credentialsSupported = openIdConfiguration.credentialsSupported; + + dynamic credentailData; + + for (final dynamic cred in credentialsSupported!) { + if (cred is Map && + ((cred.containsKey('scope') && + cred['scope'].toString() == credential) || + (cred.containsKey('id') && + cred['id'].toString() == credential))) { + credentailData = cred; + break; + } + } - if (credentialsSupported == null) { - throw Exception(); - } + if (credentailData == null) { + throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR'); + } + + data = { + 'type': 'openid_credential', + 'locations': [issuer], + 'format': credentailData['format'], + 'types': credentailData['types'], + }; + + credentials.add((credentailData['types'] as List).last); + } else if (openIdConfiguration.credentialConfigurationsSupported != + null) { + // draft 13 case + final credentialsSupported = + openIdConfiguration.credentialConfigurationsSupported; + + if (credentialsSupported is! Map) { + throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR'); + } + + final credentialSupportedMapEntry = + credentialsSupported.entries.where( + (entry) { + final dynamic ele = entry.key; + + if (ele == credential) return true; - dynamic credentailData; + return false; + }, + ).firstOrNull; - for (final dynamic cred in credentialsSupported) { - if (cred is Map && - ((cred.containsKey('scope') && - cred['scope'].toString() == credential) || - (cred.containsKey('id') && - cred['id'].toString() == credential))) { - credentailData = cred; - break; + if (credentialSupportedMapEntry == null) { + throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR'); } - } - if (credentailData == null) { - throw Exception(); - } + final credentialSupported = credentialSupportedMapEntry.value; - data = { - 'type': 'openid_credential', - 'locations': [issuer], - 'format': credentailData['format'], - 'types': credentailData['types'], - }; + data = { + 'type': 'openid_credential', + 'locations': [issuer], + 'format': credentialSupported['format'], + //'types': credential['types'], + }; - credentials.add((credentailData['types'] as List).last); + final scope = credentialSupported['scope']; + + if (scope == null) { + throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR'); + } + + credentials.add(scope); + } else { + throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR'); + } } else if (credential is Map) { data = { 'type': 'openid_credential', From 4ca6714bba6076d98255f3a2751323b018cc9c18 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 16:21:56 +0545 Subject: [PATCH 2/6] Modification of Wallet Profiles list #2391 --- lib/app/shared/enum/type/profile/profile_type.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/shared/enum/type/profile/profile_type.dart b/lib/app/shared/enum/type/profile/profile_type.dart index 90104e4c3..cff571896 100644 --- a/lib/app/shared/enum/type/profile/profile_type.dart +++ b/lib/app/shared/enum/type/profile/profile_type.dart @@ -1,12 +1,12 @@ import 'package:altme/l10n/l10n.dart'; enum ProfileType { - custom, + defaultOne, ebsiV3, dutch, enterprise, owfBaselineProfile, - defaultOne + custom, } extension ProfileTypeX on ProfileType { From f74a828925105566408248afec016cd896be2a7d Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 16:26:26 +0545 Subject: [PATCH 3/6] Profile Default - disable developer and help option - #2392 --- lib/dashboard/drawer/src/view/drawer_page.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/dashboard/drawer/src/view/drawer_page.dart b/lib/dashboard/drawer/src/view/drawer_page.dart index 182669c87..da38868c4 100644 --- a/lib/dashboard/drawer/src/view/drawer_page.dart +++ b/lib/dashboard/drawer/src/view/drawer_page.dart @@ -116,7 +116,8 @@ class DrawerView extends StatelessWidget { ], if (profileModel - .profileSetting.settingsMenu.displayDeveloperMode) ...[ + .profileSetting.settingsMenu.displayDeveloperMode && + profileModel.profileType != ProfileType.defaultOne) ...[ DrawerCategoryItem( title: l10n.developerMode, subTitle: l10n.developerModeSubtitle, @@ -152,7 +153,8 @@ class DrawerView extends StatelessWidget { //const SizedBox(height: Sizes.spaceSmall), if (profileModel - .profileSetting.settingsMenu.displayHelpCenter) ...[ + .profileSetting.settingsMenu.displayHelpCenter && + profileModel.profileType != ProfileType.defaultOne) ...[ DrawerCategoryItem( title: l10n.helpCenter, subTitle: l10n.helpCenterDescription, From ce44e9d7bf6bfc3916f68f579ef405c284b990f6 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 16:49:37 +0545 Subject: [PATCH 4/6] Draft 13 , authorization code flow fails with authorization_details #2387 --- packages/oidc4vc/lib/src/oidc4vc.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index beade19c7..b3ca344aa 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -260,9 +260,7 @@ class OIDC4VC { data = { 'type': 'openid_credential', - 'locations': [issuer], - 'format': credentialSupported['format'], - //'types': credential['types'], + 'credential_configuration_id': credential, }; final scope = credentialSupported['scope']; From 411a4c067e4bf824fc0c3c30f92bce6a6473b7e8 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 18:14:49 +0545 Subject: [PATCH 5/6] OIDC4VP test 8 presentation submission is not correct #2390 --- lib/scan/cubit/scan_cubit.dart | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/scan/cubit/scan_cubit.dart b/lib/scan/cubit/scan_cubit.dart index 1931048d6..08c3c506a 100644 --- a/lib/scan/cubit/scan_cubit.dart +++ b/lib/scan/cubit/scan_cubit.dart @@ -719,29 +719,42 @@ class ScanCubit extends Cubit { filterList: filterList, credentialList: [credentialsToBePresented[i]], ); + + final pathNested = { + 'id': inputDescriptor.id, + 'format': vcFormat, + }; + if (credential.isNotEmpty) { if (credentialsToBePresented.length == 1) { + if (vpFormat == 'ldp_vp') { + pathNested['path'] = r'$.verifiableCredential'; + } else { + pathNested['path'] = r'$.vp.verifiableCredential[0]'; + } + inputDescriptors.add({ 'id': inputDescriptor.id, 'format': vpFormat, 'path': r'$', - 'path_nested': { - 'id': inputDescriptor.id, - 'format': vcFormat, - 'path': r'$.verifiableCredential', - }, + 'path_nested': pathNested, }); } else { + if (vpFormat == 'ldp_vp') { + pathNested['path'] = + // ignore: prefer_interpolation_to_compose_strings + r'$.verifiableCredential[' + i.toString() + ']'; + } else { + pathNested['path'] = + // ignore: prefer_interpolation_to_compose_strings + r'$.vp.verifiableCredential[' + i.toString() + ']'; + } + inputDescriptors.add({ 'id': inputDescriptor.id, 'format': vpFormat, 'path': r'$', - 'path_nested': { - 'id': inputDescriptor.id, - 'format': vcFormat, - // ignore: prefer_interpolation_to_compose_strings - 'path': r'$.verifiableCredential[' + i.toString() + ']', - }, + 'path_nested': pathNested, }); } } From 394037e6825e3c241dadce15193715d89b3187ac Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Thu, 15 Feb 2024 18:43:46 +0545 Subject: [PATCH 6/6] version update to 2.2.25+387 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2d76addc7..0fb6a7859 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: altme description: AltMe Flutter App -version: 2.2.24+386 +version: 2.2.25+387 environment: sdk: ">=3.1.0 <4.0.0"