From 7925112c6da0552cab171a601bacbdcebbee9d28 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 17 Apr 2024 18:17:06 +0545 Subject: [PATCH] feat: optimise and pass OIDC4VCP test 13 #2600 --- .../helper_functions/helper_functions.dart | 26 +++++++++++++++++-- .../get_credentials_from_filter_list.dart | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/app/shared/helper_functions/helper_functions.dart b/lib/app/shared/helper_functions/helper_functions.dart index 0a1715839..fafe47548 100644 --- a/lib/app/shared/helper_functions/helper_functions.dart +++ b/lib/app/shared/helper_functions/helper_functions.dart @@ -1802,14 +1802,16 @@ Map createJsonByDecryptingSDValues({ }) { final json = {}; + final sh256HashToContent = selectiveDisclosure.sh256HashToContent; + encryptedJson.forEach((key, value) { if (key == '_sd') { final sd = encryptedJson['_sd']; if (sd is List) { for (final sdValue in sd) { - if (selectiveDisclosure.sh256HashToContent.containsKey(sdValue)) { - final content = selectiveDisclosure.sh256HashToContent[sdValue]; + if (sh256HashToContent.containsKey(sdValue)) { + final content = sh256HashToContent[sdValue]; if (content is Map) { content.forEach((key, value) { json[key.toString()] = value; @@ -1825,6 +1827,26 @@ Map createJsonByDecryptingSDValues({ encryptedJson: value, ); json[key] = nestedJson; + } else if (value is List) { + final list = []; + + for (final ele in value) { + if (ele is Map) { + final threeDotValue = ele['...']; + if (sh256HashToContent.containsKey(threeDotValue)) { + final content = sh256HashToContent[threeDotValue]; + if (content is Map) { + content.forEach((key, value) { + list.add(value.toString()); + }); + } + } + } else { + list.add(ele.toString()); + } + } + + json[key] = list; } else { json[key] = value; } diff --git a/lib/dashboard/home/tab_bar/credentials/present/pick/credential_manifest/helpers/get_credentials_from_filter_list.dart b/lib/dashboard/home/tab_bar/credentials/present/pick/credential_manifest/helpers/get_credentials_from_filter_list.dart index a5ecc374a..6ac7ad1db 100644 --- a/lib/dashboard/home/tab_bar/credentials/present/pick/credential_manifest/helpers/get_credentials_from_filter_list.dart +++ b/lib/dashboard/home/tab_bar/credentials/present/pick/credential_manifest/helpers/get_credentials_from_filter_list.dart @@ -33,7 +33,7 @@ List getCredentialsFromFilterList({ } else if (field.filter?.contains?.containsConst != null) { pattern = field.filter?.contains?.containsConst; } else { - /// sd-jwt vc case + /// sd-jwt vc bool case if (searchParameter == 'true') return false; }