Skip to content

Commit

Permalink
Update for vc-sd-jwt - pathNested ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed May 23, 2024
1 parent 74baf8c commit fff8b85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,18 @@ class MissingCredentialsCubit extends Cubit<MissingCredentialsState> {
credentialField['filter'] as Map<String, dynamic>,
);

final credentialName =
filter.pattern ?? filter.contains!.containsConst;
final credentialName = filter.pattern ??
filter.contains?.containsConst ??
filter.containsConst;

if (credentialName == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Invalid presentatoin Definition.',
},
);
}

final CredentialSubjectType? credentialSubjectType =
getCredTypeFromName(credentialName);
Expand Down
12 changes: 5 additions & 7 deletions lib/scan/cubit/scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@ class ScanCubit extends Cubit<ScanState> {
'definition_id': presentationDefinition.id,
};

final vcFormatType = profileSetting
.selfSovereignIdentityOptions.customOidc4vcProfile.vcFormatType;

final inputDescriptors = <Map<String, dynamic>>[];

String? vcFormat;
Expand Down Expand Up @@ -761,8 +764,6 @@ class ScanCubit extends Cubit<ScanState> {
}
} else {
if (clientMetaData == null) {
final vcFormatType = profileSetting
.selfSovereignIdentityOptions.customOidc4vcProfile.vcFormatType;
vcFormat = vcFormatType.vcValue;
vpFormat = vcFormatType.vpValue;
} else {
Expand Down Expand Up @@ -800,7 +801,7 @@ class ScanCubit extends Cubit<ScanState> {

Map<String, dynamic>? pathNested;

if (!(inputDescriptor.id == null || vcFormat == null)) {
if (vcFormatType != VCFormatType.vcSdJWT) {
pathNested = {
'id': inputDescriptor.id,
'format': vcFormat,
Expand All @@ -814,7 +815,7 @@ class ScanCubit extends Cubit<ScanState> {
'path': r'$',
};

if (pathNested != null) {
if (vcFormatType != VCFormatType.vcSdJWT && pathNested != null) {
if (credentialsToBePresented.length == 1) {
if (vpFormat == 'ldp_vp') {
pathNested['path'] = r'$.verifiableCredential';
Expand All @@ -836,9 +837,6 @@ class ScanCubit extends Cubit<ScanState> {
r'$.vp.verifiableCredential[' + i.toString() + ']';
}
}
}

if (pathNested != null) {
descriptor['path_nested'] = pathNested;
}

Expand Down

0 comments on commit fff8b85

Please sign in to comment.