Skip to content

Commit

Permalink
feat: add request in the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Aug 30, 2023
1 parent d564a4b commit 44ba410
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 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 @@ -205,9 +205,10 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
}

final String? requestUri = state.uri?.queryParameters['request_uri'];
final String? request = state.uri?.queryParameters['request'];

/// check if request uri is provided or not
if (requestUri != null) {
if (requestUri != null || request != null) {
/// verifier side (oidc4vp) or (siopv2 oidc4vc) with request_uri
/// verify the encoded data first
await verifyJWTBeforeLaunchingOIDC4VCANDSIOPV2Flow();
Expand Down Expand Up @@ -717,9 +718,14 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {

/// verify jwt
Future<void> verifyJWTBeforeLaunchingOIDC4VCANDSIOPV2Flow() async {
final requestUri = state.uri!.queryParameters['request_uri'].toString();
final String? requestUri = state.uri?.queryParameters['request_uri'];
final String? request = state.uri?.queryParameters['request'];

encodedData = await fetchRequestUriPayload(url: requestUri);
if (requestUri != null) {
encodedData = await fetchRequestUriPayload(url: requestUri);
} else {
encodedData = request;
}

final Map<String, dynamic> payload =
decodePayload(jwtDecode: jwtDecode, token: encodedData as String);
Expand Down

0 comments on commit 44ba410

Please sign in to comment.