Skip to content

Commit

Permalink
feat: subject_syntax_types_supported made optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 3, 2023
1 parent 9433564 commit dd3c301
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -504,23 +504,31 @@ Future<OIDC4VCType?> getOIDC4VCTypeForIssuance({
final authorizationServer =
openidConfigurationResponse['authorization_server'];

List<dynamic> subjectSyntaxTypesSupported;
List<dynamic>? subjectSyntaxTypesSupported;

if (authorizationServer == null) {
subjectSyntaxTypesSupported =
openidConfigurationResponse['subject_syntax_types_supported']
as List<dynamic>;
if (openidConfigurationResponse
.containsKey('subject_syntax_types_supported')) {
subjectSyntaxTypesSupported =
openidConfigurationResponse['subject_syntax_types_supported']
as List<dynamic>;
}
} else {
final openidConfigurationResponse = await getOpenIdConfig(
baseUrl: authorizationServer.toString(),
client: client.dio,
);
subjectSyntaxTypesSupported =
openidConfigurationResponse['subject_syntax_types_supported']
as List<dynamic>;

if (openidConfigurationResponse
.containsKey('subject_syntax_types_supported')) {
subjectSyntaxTypesSupported =
openidConfigurationResponse['subject_syntax_types_supported']
as List<dynamic>;
}
}

if (!subjectSyntaxTypesSupported.contains('did:key')) {
if (subjectSyntaxTypesSupported != null &&
!subjectSyntaxTypesSupported.contains('did:key')) {
throw Exception('Subject_Syntax_Type_Not_Supported');
}

Expand Down

0 comments on commit dd3c301

Please sign in to comment.