Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization server #3220

Merged
merged 38 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2a79877
feat: Wording of error message update for invalid_grant #3205
bibash28 Dec 18, 2024
9f9ec2a
feat: Update wording #3198
bibash28 Dec 18, 2024
3a0aac6
feat: Update wording #3199
bibash28 Dec 18, 2024
33344cc
feat: Setup draft 13 for custom #3203
bibash28 Dec 18, 2024
ab78971
feat: Remove alg and use from headers of jwt #3202
bibash28 Dec 18, 2024
3e504e9
Merge branch 'main' into october
bibash28 Dec 18, 2024
92d8d82
version update: 2.18.14+5587
bibash28 Dec 18, 2024
40a61b2
feat: Update french translation #3206
bibash28 Dec 19, 2024
dcf01f4
feat: Add switch for OIDC4VP #3159
bibash28 Dec 19, 2024
03de78c
feat: Remove client id scheme for draft 22 and above #3160
bibash28 Dec 19, 2024
c1a67b6
version update: 2.18.15+5588
bibash28 Dec 19, 2024
5ecc573
feat: Update french language #3213
bibash28 Dec 20, 2024
2cb1495
feat: Update client id fetching ways #3215
bibash28 Dec 20, 2024
955b994
feat: Update VC not available screen update #3212
bibash28 Dec 20, 2024
2e543ba
feat: Return error when user cancels the presentation #3207
bibash28 Dec 20, 2024
0703556
feat: Return error when User dont have VC requested #3208
bibash28 Dec 20, 2024
62e417e
feat: Return error when User dont have VC requested #3208
bibash28 Dec 20, 2024
58bac82
feat: Return error when User cannot authenticate #3209
bibash28 Dec 20, 2024
407bd1e
feat: Send errrors back to verifier #3210
bibash28 Dec 20, 2024
7232a54
version update: 2.18.16+5589
bibash28 Dec 20, 2024
3f71b3b
version update: 2.18.16+5589
bibash28 Dec 20, 2024
ce0a48b
Regression issue : the authorization_server endpoint in the offer is …
hawkbee1 Dec 20, 2024
31f6f58
feat: Return error when user cancels the presentation #3207
bibash28 Dec 23, 2024
b27cc69
feat: Add release in launch.json
bibash28 Dec 23, 2024
dea7bdf
feat: Handle all errors of OIDC4VP #3210
bibash28 Dec 23, 2024
2f59ae4
feat: Hide OIDC4VP switch for 10,18 #3214
bibash28 Dec 23, 2024
eb8ead2
version update: 2.18.17+5590
bibash28 Dec 23, 2024
2cc190b
Manage nested display attribute in issuer metadata for openbadge
hawkbee1 Dec 23, 2024
f264c7f
feat: Add error for client id scheme #3210
bibash28 Dec 24, 2024
5353601
feat: Solve display issue #3219
bibash28 Dec 26, 2024
c036ff9
feat: Solve display issue #3219
bibash28 Dec 27, 2024
b8f425f
version update: 2.18.19+5592
bibash28 Dec 27, 2024
666963e
remove /authorize, it should come from openId configuration
hawkbee1 Dec 30, 2024
efef84a
Merge remote-tracking branch 'origin/october' into authorization_server
hawkbee1 Dec 30, 2024
39316dc
Manage nested display attribute in issuer metadata for openbadge
hawkbee1 Dec 30, 2024
1e32ac1
version: 2.18.20+5593
hawkbee1 Dec 30, 2024
2e13344
title of jwt_json-ld depends on display from metadata
hawkbee1 Dec 30, 2024
5a306fa
version: 2.19.0+5594
hawkbee1 Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,5 @@ enum ResponseString {
RESPONSE_STRING_vpFormatsNotSupportedErrorDescription,
RESPONSE_STRING_invalidPresentationDefinitionUriErrorDescription,
RESPONSE_STRING_recoveryPhraseIncorrectErrorMessage,
RESPONSE_STRING_invalidCode,
}
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ extension ResponseStringX on ResponseString {
case ResponseString.RESPONSE_STRING_recoveryPhraseIncorrectErrorMessage:
return globalMessage
.RESPONSE_STRING_recoveryPhraseIncorrectErrorMessage;

case ResponseString.RESPONSE_STRING_invalidCode:
return globalMessage.RESPONSE_STRING_invalidCode;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ part of 'credential_subject_type.dart';

extension CredentialSubjectTypeExtension on CredentialSubjectType {
Color backgroundColor(CredentialModel credentialModel) {
final Color backgroundColor;
if (credentialModel.display?.backgroundColor != null) {
backgroundColor = Color(
int.parse(
'FF${credentialModel.display?.backgroundColor!.replaceAll('#', '')}',
radix: 16,
),
);
} else {
backgroundColor = defaultBackgroundColor;
try {
final Color backgroundColor;
if (credentialModel.display?.backgroundColor != null) {
backgroundColor = Color(
int.parse(
'FF${credentialModel.display?.backgroundColor!.replaceAll('#', '')}',
radix: 16,
),
);
} else {
backgroundColor = defaultBackgroundColor;
}
return backgroundColor;
} catch (e) {
return defaultBackgroundColor;
}
return backgroundColor;
}

Color get defaultBackgroundColor {
Expand All @@ -31,7 +35,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.selfIssued:
return const Color(0xffEFF0F6);
case CredentialSubjectType.defaultCredential:
return Colors.white;
return const Color(0xff6600FF);
case CredentialSubjectType.professionalStudentCard:
return const Color(0xffCAFFBF);
case CredentialSubjectType.kycAgeCredential:
Expand Down Expand Up @@ -88,7 +92,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return Colors.white;
return const Color(0xff6600FF);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/helper_functions/get_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dynamic getDisplay(dynamic value, String languageCode) {
element['locale'].toString().contains('en'),
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic> && element.containsKey('locale'),
element is Map<String, dynamic> && !element.containsKey('locale'),
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic>, // if local is not provided
Expand Down
34 changes: 27 additions & 7 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,10 @@ Future<String> getHost({
).host;
} else {
/// verification case
final clientId = uri.queryParameters['client_id'];

final clientId = getClientIdForPresentation(
uri.queryParameters['client_id'],
);

if (clientId != null) {
return clientId;
Expand Down Expand Up @@ -1349,6 +1352,7 @@ ResponseString getErrorResponseString(String errorString) {
return ResponseString.RESPONSE_STRING_theWalletIsNotRegistered;

case 'invalid_grant':
return ResponseString.RESPONSE_STRING_invalidCode;
case 'invalid_token':
return ResponseString.RESPONSE_STRING_credentialIssuanceDenied;

Expand Down Expand Up @@ -1503,14 +1507,14 @@ Future<dynamic> fetchRequestUriPayload({
String getUpdatedUrlForSIOPV2OIC4VP({
required Uri uri,
required Map<String, dynamic> response,
required String clientId,
}) {
final responseType = response['response_type'];
final redirectUri = response['redirect_uri'];
final scope = response['scope'];
final responseUri = response['response_uri'];
final responseMode = response['response_mode'];
final nonce = response['nonce'];
final clientId = response['client_id'];
final claims = response['claims'];
final stateValue = response['state'];
final presentationDefinition = response['presentation_definition'];
Expand All @@ -1525,7 +1529,7 @@ String getUpdatedUrlForSIOPV2OIC4VP({
queryJson['scope'] = scope;
}

if (!uri.queryParameters.containsKey('client_id') && clientId != null) {
if (!uri.queryParameters.containsKey('client_id')) {
queryJson['client_id'] = clientId;
}

Expand Down Expand Up @@ -1752,7 +1756,7 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
(Display display) => display.locale.toString().contains('en'),
) ??
credSupportedDisplay.firstWhereOrNull(
(Display display) => display.locale != null,
(Display display) => display.locale == null,
) ??
credSupportedDisplay.first; // if local is not provided
}
Expand Down Expand Up @@ -1787,7 +1791,8 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
) ??
displays.firstWhereOrNull(
(Display display) => display.locale != null,
);
) ??
displays.first; // if local is not provided
}
}
}
Expand All @@ -1804,8 +1809,9 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
(Display display) => display.locale.toString().contains('en'),
) ??
displays.firstWhereOrNull(
(Display display) => display.locale != null,
);
(Display display) => display.locale == null,
) ??
displays.first; // if local is not provided;
}
return (display, credentialSupported);
}
Expand Down Expand Up @@ -2425,3 +2431,17 @@ bool isContract(String reciever) {
if (reciever.startsWith('KT1')) return true;
return false;
}

String? getClientIdForPresentation(String? clientId) {
if (clientId == null) return '';
if (clientId.contains(':')) {
final parts = clientId.split(':');
if (parts.length == 2) {
return parts[1];
} else {
return clientId;
}
} else {
return clientId;
}
}
2 changes: 2 additions & 0 deletions lib/app/shared/message_handler/global_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,6 @@ class GlobalMessage {

String get RESPONSE_STRING_recoveryPhraseIncorrectErrorMessage =>
l10n.recoveryPhraseIncorrectErrorMessage;

String get RESPONSE_STRING_invalidCode => l10n.invalidCode;
}
5 changes: 5 additions & 0 deletions lib/app/shared/message_handler/response_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,11 @@ class ResponseMessage with MessageHandler {
.RESPONSE_STRING_recoveryPhraseIncorrectErrorMessage.localise(
context,
);

case ResponseString.RESPONSE_STRING_invalidCode:
return ResponseString.RESPONSE_STRING_invalidCode.localise(
context,
);
}
}
return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class Oidc4vcSettingMenuView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SecurityLevelWidget(),
const DidKeyTypeWidget(),
const DraftTypeWidget(),
const KeyIdentifierAndKeyTypeWidget(),
const OIDC4VCDraftTypeWidget(),
const OIDC4VPDraftTypeWidget(),
const CryptographicHolderBindingWidget(),
const ScopeParameterWidget(),
const ClientAuthenticationWidget(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ClientTypeWidget extends StatelessWidget {
return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return OptionContainer(
title: 'Wallet Client_id Scheme',
title: 'OIDC4VCI client_id value',
body: ListView.builder(
itemCount: ClientType.values.length,
shrinkWrap: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oidc4vc/oidc4vc.dart';

class DidKeyTypeWidget extends StatelessWidget {
const DidKeyTypeWidget({super.key});
class KeyIdentifierAndKeyTypeWidget extends StatelessWidget {
const KeyIdentifierAndKeyTypeWidget({super.key});

@override
Widget build(BuildContext context) {
return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return OptionContainer(
title: 'Default DID',
subtitle: 'Select one of the DIDs',
title: 'Key identifier and key type',
subtitle: 'Select jwk thumbprint or a DID method',
body: ListView.builder(
itemCount: DidKeyType.values.length,
shrinkWrap: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oidc4vc/oidc4vc.dart';

class DraftTypeWidget extends StatelessWidget {
const DraftTypeWidget({super.key});
class OIDC4VCDraftTypeWidget extends StatelessWidget {
const OIDC4VCDraftTypeWidget({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:altme/app/app.dart';
import 'package:altme/app/shared/widget/divider_for_radio_list.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oidc4vc/oidc4vc.dart';

class OIDC4VPDraftTypeWidget extends StatelessWidget {
const OIDC4VPDraftTypeWidget({super.key});

@override
Widget build(BuildContext context) {
return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return OptionContainer(
title: 'OIDC4VP',
subtitle: 'Protocole standard release',
body: ListView.builder(
itemCount: OIDC4VPDraftType.values.length,
shrinkWrap: true,
physics: const ScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
final draftType = OIDC4VPDraftType.values[index];

if (draftType == OIDC4VPDraftType.draft10 ||
draftType == OIDC4VPDraftType.draft13 ||
draftType == OIDC4VPDraftType.draft18 ||
draftType == OIDC4VPDraftType.draft23) return Container();

return Column(
children: [
ListTile(
onTap: () {
context.read<ProfileCubit>().updateProfileSetting(
oidc4vpDraftType: draftType,
);
},
shape: RoundedRectangleBorder(
side: BorderSide(
color: Theme.of(context).colorScheme.onSurface,
width: 0.5,
),
),
title: Text(
draftType.formattedString,
style: Theme.of(context).textTheme.bodyLarge,
),
trailing: Icon(
state.model.profileSetting.selfSovereignIdentityOptions
.customOidc4vcProfile.oidc4vpDraft ==
draftType
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: Sizes.icon2x,
color: Theme.of(context).colorScheme.primary,
),
),
const DividerForRadioList(),
],
);
},
),
);
},
);
}
}
3 changes: 2 additions & 1 deletion lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export 'client_type_widget.dart';
export 'cryptograhic_holder_binding.dart';
export 'did_key_type_widget.dart';
export 'dpop_support_widget.dart';
export 'draft_type_widget.dart';
export 'oidc4vc_draft_type_widget.dart';
export 'oidc4vp_draft_type_widget.dart';
export 'option_container.dart';
export 'pre_registered_widget.dart';
export 'proof_header_widget.dart';
Expand Down
Loading
Loading