Skip to content

Commit

Permalink
feat: Add code for dpop support #3034
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 5, 2024
1 parent 201b1a8 commit af31109
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Oidc4vcSettingMenuView extends StatelessWidget {
const ProofHeaderWidget(),
const PushAuthorizationRequesWidget(),
const StatusListCachingWidget(),
//const DPopSupoprtWidget(),
DrawerItem(
title: 'Wallet metadata for issuers',
onTap: () {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ProfileCubit, ProfileState>(
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<ProfileCubit>().updateProfileSetting(
dpopSupport: value,
);
},
value: state.model.profileSetting.selfSovereignIdentityOptions
.customOidc4vcProfile.dpopSupport,
activeColor: Theme.of(context).colorScheme.primary,
),
);
},
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 2 additions & 0 deletions lib/dashboard/profile/cubit/profile_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ class ProfileCubit extends Cubit<ProfileState> {
bool? pushAuthorizationRequest,
bool? statusListCaching,
bool? displayNotification,
bool? dpopSupport,
}) async {
final profileModel = state.model.copyWith(
profileSetting: state.model.profileSetting.copyWith(
Expand Down Expand Up @@ -477,6 +478,7 @@ class ProfileCubit extends Cubit<ProfileState> {
proofType: proofType,
pushAuthorizationRequest: pushAuthorizationRequest,
statusListCache: statusListCaching,
dpopSupport: dpopSupport,
),
),
),
Expand Down
5 changes: 5 additions & 0 deletions lib/dashboard/profile/models/profile_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -728,6 +729,7 @@ class CustomOidc4VcProfile extends Equatable {
@JsonKey(name: 'vcFormat')
final VCFormatType vcFormatType;
final ProofType proofType;
final bool dpopSupport;

Map<String, dynamic> toJson() => _$CustomOidc4VcProfileToJson(this);

Expand Down Expand Up @@ -764,6 +766,7 @@ class CustomOidc4VcProfile extends Equatable {
ClientType? clientType,
VCFormatType? vcFormatType,
ProofType? proofType,
bool? dpopSupport,
}) =>
CustomOidc4VcProfile(
clientAuthentication: clientAuthentication ?? this.clientAuthentication,
Expand All @@ -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
Expand All @@ -806,6 +810,7 @@ class CustomOidc4VcProfile extends Equatable {
clientType,
vcFormatType,
proofType,
dpopSupport,
];
}

Expand Down
2 changes: 2 additions & 0 deletions lib/dashboard/profile/models/profile_setting.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit af31109

Please sign in to comment.