diff --git a/lib/dashboard/drawer/ssi/oidc4vc_settngs/view/oidc4vc_settings_menu.dart b/lib/dashboard/drawer/ssi/oidc4vc_settngs/view/oidc4vc_settings_menu.dart index d3ab5f826..fc02edc3d 100644 --- a/lib/dashboard/drawer/ssi/oidc4vc_settngs/view/oidc4vc_settings_menu.dart +++ b/lib/dashboard/drawer/ssi/oidc4vc_settngs/view/oidc4vc_settings_menu.dart @@ -49,6 +49,7 @@ class Oidc4vcSettingMenuView extends StatelessWidget { const ProofHeaderWidget(), const PushAuthorizationRequesWidget(), const StatusListCachingWidget(), + //const DPopSupoprtWidget(), DrawerItem( title: 'Wallet metadata for issuers', onTap: () { diff --git a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/dpop_support_widget.dart b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/dpop_support_widget.dart new file mode 100644 index 000000000..e378a3427 --- /dev/null +++ b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/dpop_support_widget.dart @@ -0,0 +1,29 @@ +import 'package:altme/dashboard/dashboard.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +class DPopSupoprtWidget extends StatelessWidget { + const DPopSupoprtWidget({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder( + builder: (context, state) { + return OptionContainer( + title: 'Demonstrating Proof of Possession (DPoP)', + subtitle: 'Enable to protect code and access token.', + body: Switch( + onChanged: (value) async { + await context.read().updateProfileSetting( + dpopSupport: value, + ); + }, + value: state.model.profileSetting.selfSovereignIdentityOptions + .customOidc4vcProfile.dpopSupport, + activeColor: Theme.of(context).colorScheme.primary, + ), + ); + }, + ); + } +} diff --git a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart index fd70d3be3..fa5ad832f 100644 --- a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart +++ b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart @@ -3,6 +3,7 @@ export 'client_type_widget.dart'; export 'confidential_client_widget.dart'; export 'cryptograhic_holder_binding.dart'; export 'did_key_type_widget.dart'; +export 'dpop_support_widget.dart'; export 'draft_type_widget.dart'; export 'option_container.dart'; export 'proof_header_widget.dart'; diff --git a/lib/dashboard/profile/cubit/profile_cubit.dart b/lib/dashboard/profile/cubit/profile_cubit.dart index d0452efe8..e332b1881 100644 --- a/lib/dashboard/profile/cubit/profile_cubit.dart +++ b/lib/dashboard/profile/cubit/profile_cubit.dart @@ -442,6 +442,7 @@ class ProfileCubit extends Cubit { bool? pushAuthorizationRequest, bool? statusListCaching, bool? displayNotification, + bool? dpopSupport, }) async { final profileModel = state.model.copyWith( profileSetting: state.model.profileSetting.copyWith( @@ -477,6 +478,7 @@ class ProfileCubit extends Cubit { proofType: proofType, pushAuthorizationRequest: pushAuthorizationRequest, statusListCache: statusListCaching, + dpopSupport: dpopSupport, ), ), ), diff --git a/lib/dashboard/profile/models/profile_setting.dart b/lib/dashboard/profile/models/profile_setting.dart index 70b046d05..c38ddcc8c 100644 --- a/lib/dashboard/profile/models/profile_setting.dart +++ b/lib/dashboard/profile/models/profile_setting.dart @@ -681,6 +681,7 @@ class CustomOidc4VcProfile extends Equatable { this.proofType = ProofType.jwt, this.pushAuthorizationRequest = false, this.statusListCache = true, + this.dpopSupport = false, }); factory CustomOidc4VcProfile.initial() => CustomOidc4VcProfile( @@ -728,6 +729,7 @@ class CustomOidc4VcProfile extends Equatable { @JsonKey(name: 'vcFormat') final VCFormatType vcFormatType; final ProofType proofType; + final bool dpopSupport; Map toJson() => _$CustomOidc4VcProfileToJson(this); @@ -764,6 +766,7 @@ class CustomOidc4VcProfile extends Equatable { ClientType? clientType, VCFormatType? vcFormatType, ProofType? proofType, + bool? dpopSupport, }) => CustomOidc4VcProfile( clientAuthentication: clientAuthentication ?? this.clientAuthentication, @@ -785,6 +788,7 @@ class CustomOidc4VcProfile extends Equatable { clientSecret: clientSecret ?? this.clientSecret, vcFormatType: vcFormatType ?? this.vcFormatType, proofType: proofType ?? this.proofType, + dpopSupport: dpopSupport ?? this.dpopSupport, ); @override @@ -806,6 +810,7 @@ class CustomOidc4VcProfile extends Equatable { clientType, vcFormatType, proofType, + dpopSupport, ]; } diff --git a/lib/dashboard/profile/models/profile_setting.g.dart b/lib/dashboard/profile/models/profile_setting.g.dart index f336c9145..e27b23f4a 100644 --- a/lib/dashboard/profile/models/profile_setting.g.dart +++ b/lib/dashboard/profile/models/profile_setting.g.dart @@ -242,6 +242,7 @@ CustomOidc4VcProfile _$CustomOidc4VcProfileFromJson( pushAuthorizationRequest: json['pushAuthorizationRequest'] as bool? ?? false, statusListCache: json['statusListCache'] as bool? ?? true, + dpopSupport: json['dpopSupport'] as bool? ?? false, ); Map _$CustomOidc4VcProfileToJson( @@ -265,6 +266,7 @@ Map _$CustomOidc4VcProfileToJson( 'subjectSyntaxeType': _$ClientTypeEnumMap[instance.clientType]!, 'vcFormat': _$VCFormatTypeEnumMap[instance.vcFormatType]!, 'proofType': _$ProofTypeEnumMap[instance.proofType]!, + 'dpopSupport': instance.dpopSupport, }; const _$ClientAuthenticationEnumMap = {