Skip to content

Commit

Permalink
refactor: OIDC4VP error management for presentation definition #2029
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 19, 2023
1 parent 678b094 commit 8763027
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,37 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
);
}

if (presentationDefinition.inputDescriptors.isEmpty) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description':
'The input_descriptors is required in the presentation_definition'
' object',
},
);
}

if (presentationDefinition.format == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Presentation definition is invalid',
},
);
}

for (final descriptor in presentationDefinition.inputDescriptors) {
if (descriptor.constraints == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Presentation definition is invalid',
},
);
}
}

final CredentialManifest credentialManifest = CredentialManifest(
'id',
IssuedBy('', ''),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,10 @@ packages:
dependency: "direct main"
description:
name: file_saver
sha256: "591d25e750e3a4b654f7b0293abc2ed857242f82ca7334051b2a8ceeb369dac8"
sha256: "8ffd91ae9f543c5ebbfec71a814ee5aa9e21176d31335133308abf63f4c42e8a"
url: "https://pub.dev"
source: hosted
version: "0.2.8"
version: "0.2.9"
file_selector_linux:
dependency: transitive
description:
Expand Down

0 comments on commit 8763027

Please sign in to comment.