Skip to content

Commit

Permalink
fix: Add nationality element and remove unecessary data #2553 #2552
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 2, 2024
1 parent 1ce5372 commit 4b3b769
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/selective_disclosure/selective_disclosure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,35 @@ class SelectiveDisclosure {

try {
if (data != null && data is List<dynamic>) {
final value = [];
final value = <dynamic>[];
for (final ele in data) {
if (ele is String) {
value.add(ele);
} else if (ele is Map) {
final threeDotValue = ele['...'];

if (threeDotValue != null) {
// what to do?
for (final element in decryptedDatas) {
final oidc4vc = OIDC4VC();
final sh256Hash = oidc4vc.sh256HashOfContent(element);

if (sh256Hash == threeDotValue) {
if (element.startsWith('[') && element.endsWith(']')) {
final trimmedElement =
element.substring(1, element.length - 1).split(',');
value.add(trimmedElement.last.replaceAll('"', ''));
}
}
}
}
}
}
data = value.toString();

data = value;
}
// ignore: empty_catches
} catch (e) {}

return (data.toString(), isfromDisclosureOfJWT);
return (data?.toString(), isfromDisclosureOfJWT);
}
}

0 comments on commit 4b3b769

Please sign in to comment.