Skip to content

Commit

Permalink
some optional params fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 18, 2024
1 parent 9f54665 commit 4914a27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 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 @@ -1360,8 +1360,13 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
}
}

if (savedAccessToken == null || savedNonce == null) {
throw Exception();
if (savedAccessToken == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Access token is not provided.',
},
);
}

/// get credentials
Expand All @@ -1379,7 +1384,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
clientId: clientId,
profileCubit: profileCubit,
accessToken: savedAccessToken!,
nonce: savedNonce!,
nonce: savedNonce,
authorizationDetails: savedAuthorizationDetails,
openIdConfiguration: openIdConfiguration,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/oidc4vc/get_credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Future<
required DidKeyType didKeyType,
required String? clientId,
required String accessToken,
required String nonce,
required String? nonce,
required OpenIdConfiguration openIdConfiguration,
required List<dynamic>? authorizationDetails,
}) async {
Expand Down
4 changes: 2 additions & 2 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class OIDC4VC {
required ProofType proofType,
required OpenIdConfiguration openIdConfiguration,
required String accessToken,
required String cnonce,
required String? cnonce,
List<dynamic>? authorizationDetails,
}) async {
var nonce = cnonce;
Expand Down Expand Up @@ -617,7 +617,7 @@ class OIDC4VC {
required String kid,
required String privateKey,
required String accessToken,
required String nonce,
required String? nonce,
}) async {
final credentialData = await buildCredentialData(
nonce: nonce,
Expand Down

0 comments on commit 4914a27

Please sign in to comment.