Skip to content

Commit

Permalink
Re-add diipv2.1 code and commented it #3072
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 12, 2024
1 parent 864ce82 commit 1e39af6
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/app/shared/enum/type/profile/profile_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ enum ProfileType {
defaultOne,
ebsiV3,
ebsiV4,
//diipv2point1,
diipv3,
custom,
enterprise,
Expand All @@ -18,6 +19,8 @@ extension ProfileTypeX on ProfileType {
return 'European Blockchain Services Infrastructure (EBSI v4.0)';
case ProfileType.enterprise:
return name.isEmpty ? 'Enterprise' : name;
// case ProfileType.diipv2point1:
// return 'Decentralized Identity Interop Profile (DIIP v2.1)';
case ProfileType.diipv3:
return 'Decentralized Identity Interop Profile (DIIP v3.0)';
case ProfileType.defaultOne:
Expand All @@ -31,6 +34,7 @@ extension ProfileTypeX on ProfileType {
switch (this) {
case ProfileType.custom:
case ProfileType.defaultOne:
// case ProfileType.diipv2point1:
return false;
case ProfileType.ebsiV3:
case ProfileType.ebsiV4:
Expand Down
1 change: 1 addition & 0 deletions lib/app/shared/widget/wallet_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class WalletLogo extends StatelessWidget {
? generalOptions.companyLogoLight ?? generalOptions.companyLogo
: generalOptions.companyLogo;

//case ProfileType.diipv2point1:
case ProfileType.diipv3:
image = ImageStrings.diipLogo;
}
Expand Down
35 changes: 35 additions & 0 deletions lib/dashboard/profile/cubit/profile_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,26 @@ class ProfileCubit extends Cubit<ProfileState> {
enterpriseWalletName: enterpriseWalletName,
);

// case ProfileType.diipv2point1:
// final privateKey = await getPrivateKey(
// didKeyType: Parameters.didKeyTypeForDutch,
// profileCubit: this,
// );
// final (did, _) = await getDidAndKid(
// didKeyType: Parameters.didKeyTypeForDutch,
// privateKey: privateKey,
// profileCubit: this,
// );
// profileModel = ProfileModel.diipv2point1(
// polygonIdNetwork: polygonIdNetwork,
// walletType: walletType,
// walletProtectionType: walletProtectionType,
// isDeveloperMode: isDeveloperMode,
// clientId: did,
// clientSecret: randomString(12),
// enterpriseWalletName: enterpriseWalletName,
// );

case ProfileType.diipv3:
final privateKey = await getPrivateKey(
didKeyType: Parameters.didKeyTypeForOwfBaselineProfile,
Expand Down Expand Up @@ -630,6 +650,21 @@ class ProfileCubit extends Cubit<ProfileState> {
),
);

// case ProfileType.diipv2point1:
// await update(
// ProfileModel.diipv2point1(
// polygonIdNetwork: state.model.polygonIdNetwork,
// walletProtectionType: state.model.walletProtectionType,
// isDeveloperMode: state.model.isDeveloperMode,
// walletType: state.model.walletType,
// enterpriseWalletName: state.model.enterpriseWalletName,
// clientId: state.model.profileSetting.selfSovereignIdentityOptions
// .customOidc4vcProfile.clientId,
// clientSecret: state.model.profileSetting
// .selfSovereignIdentityOptions.customOidc4vcProfile.clientSecret,
// ),
// );

case ProfileType.diipv3:
await update(
ProfileModel.diipv3(
Expand Down
74 changes: 74 additions & 0 deletions lib/dashboard/profile/models/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,80 @@ class ProfileModel extends Equatable {
),
);

// factory ProfileModel.diipv2point1({
// required PolygonIdNetwork polygonIdNetwork,
// required WalletType walletType,
// required WalletProtectionType walletProtectionType,
// required bool isDeveloperMode,
// required String? clientId,
// required String? clientSecret,
// String? enterpriseWalletName,
// }) =>
// ProfileModel(
// enterpriseWalletName: enterpriseWalletName,
// polygonIdNetwork: polygonIdNetwork,
// walletType: walletType,
// walletProtectionType: walletProtectionType,
// isDeveloperMode: isDeveloperMode,
// profileType: ProfileType.diipv2point1,
// profileSetting: ProfileSetting(
// blockchainOptions: BlockchainOptions.initial(),
// generalOptions: GeneralOptions.empty(),
// helpCenterOptions: HelpCenterOptions.initial(),
// discoverCardsOptions: const DiscoverCardsOptions(
// displayDefi: false,
// displayHumanity: false,
// displayHumanityJwt: false,
// displayOver13: false,
// displayOver15: false,
// displayOver18: false,
// displayOver18Jwt: true,
// displayOver21: false,
// displayOver50: false,
// displayChainborn: false,
// displayTezotopia: false,
// displayVerifiableId: true,
// displayVerifiableIdJwt: true,
// displayOver65: false,
// displayEmailPass: true,
// displayEmailPassJwt: true,
// displayPhonePass: false,
// displayPhonePassJwt: true,
// displayAgeRange: false,
// displayGender: false,
// displayExternalIssuer: [],
// ),
// selfSovereignIdentityOptions: SelfSovereignIdentityOptions(
// displayManageDecentralizedId: true,
// customOidc4vcProfile: CustomOidc4VcProfile(
// clientAuthentication: ClientAuthentication.clientId,
// credentialManifestSupport: false,
// cryptoHolderBinding: true,
// defaultDid: Parameters.didKeyTypeForDutch,
// oidc4vciDraft: OIDC4VCIDraftType.draft13,
// oidc4vpDraft: OIDC4VPDraftType.draft10,
// scope: true,
// securityLevel: true,
// proofHeader: ProofHeaderType.kid,
// siopv2Draft: SIOPV2DraftType.draft12,
// clientType: ClientType.did,
// clientId: clientId,
// clientSecret: clientSecret,
// vcFormatType: VCFormatType.jwtVcJson,
// proofType: ProofType.jwt,
// ),
// ),
// settingsMenu: SettingsMenu.initial(),
// version: '',
// walletSecurityOptions: const WalletSecurityOptions(
// confirmSecurityVerifierAccess: true,
// displaySecurityAdvancedSettings: true,
// secureSecurityAuthenticationWithPinCode: true,
// verifySecurityIssuerWebsiteIdentity: true,
// ),
// ),
// );

factory ProfileModel.diipv3({
required PolygonIdNetwork polygonIdNetwork,
required WalletType walletType,
Expand Down
1 change: 1 addition & 0 deletions test/app/shared/enum/type/profile/profile_type_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ void main() {
test('Show Sponsered By', () {
expect(ProfileType.custom.showSponseredBy, false);
expect(ProfileType.ebsiV3.showSponseredBy, true);
//expect(ProfileType.diipv2point1.showSponseredBy, false);
expect(ProfileType.enterprise.showSponseredBy, true);
expect(ProfileType.diipv3.showSponseredBy, true);
expect(ProfileType.defaultOne.showSponseredBy, false);
Expand Down
43 changes: 43 additions & 0 deletions test/app/shared/widget/wallet_logo_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,49 @@ void main() {
});
});

// testWidgets(
// 'displays correct image for ProfileType.diipv2point1 in development',
// (WidgetTester tester) async {
// when(() => mockFlavorCubit.state).thenReturn(FlavorMode.development);
// when(() => mockProfileCubit.state).thenReturn(
// ProfileState(
// model: ProfileModel.diipv2point1(
// polygonIdNetwork: PolygonIdNetwork.PolygonMainnet,
// walletType: WalletType.personal,
// walletProtectionType: WalletProtectionType.FA2,
// isDeveloperMode: true,
// clientId: 'clientId',
// clientSecret: 'clientSecret',
// ),
// ),
// );
// await tester.pumpApp(
// Scaffold(
// body: Builder(
// builder: (context) {
// return MultiBlocProvider(
// providers: [
// BlocProvider<FlavorCubit>(
// create: (context) => mockFlavorCubit,
// ),
// BlocProvider<ProfileCubit>(
// create: (context) => mockProfileCubit,
// ),
// ],
// child: const WalletLogo(height: 100, width: 100),
// );
// },
// ),
// ),
// );
// await tester.pumpAndSettle();
// final imageFinder = find.byType(Image);
// expect(imageFinder, findsOneWidget);
// final Image image = tester.widget(imageFinder);
// final AssetImage imageProvider = image.image as AssetImage;
// expect(imageProvider.assetName, ImageStrings.diipLogo);
// });

testWidgets('displays correct image for ProfileType.ebsiV3 in development',
(WidgetTester tester) async {
when(() => mockFlavorCubit.state).thenReturn(FlavorMode.development);
Expand Down

0 comments on commit 1e39af6

Please sign in to comment.