Skip to content

Commit

Permalink
feat: Consider client_metadata and registration parameter data as same
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 2, 2023
1 parent 6ddc494 commit 4bbb03d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion 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 @@ -532,9 +532,10 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
);
}

final registration = state.uri!.queryParameters['registration'];
final bool isSecurityHigh = profileCubit.state.model.enableSecurity;

final registration = state.uri!.queryParameters['registration'];

if (registration != null) {
final registrationMap = jsonDecode(registration) as Map<String, dynamic>;
final data =
Expand All @@ -551,6 +552,24 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
}
}

final clientMetadata = state.uri!.queryParameters['client_metadata'];
if (clientMetadata != null) {
final clientMetadataMap =
jsonDecode(clientMetadata) as Map<String, dynamic>;
final data =
clientMetadataMap['subject_syntax_types_supported'] as List<dynamic>;
if (!data.contains('did:key')) {
if (isSecurityHigh) {
throw ResponseMessage(
data: {
'error': 'unsupported_response_type',
'error_description': 'The subject syntax type is not supported.',
},
);
}
}
}

final redirectUri = state.uri!.queryParameters['redirect_uri'];
final clientId = state.uri!.queryParameters['client_id'];
final isClientIdUrl = isURL(clientId.toString());
Expand Down

0 comments on commit 4bbb03d

Please sign in to comment.