Skip to content

Commit

Permalink
Merge branch 'october'
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Feb 14, 2024
2 parents 8b13abf + 8f9c8a4 commit a70f174
Show file tree
Hide file tree
Showing 39 changed files with 498 additions and 269 deletions.
6 changes: 6 additions & 0 deletions lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:altme/app/shared/enum/enum.dart';
import 'package:altme/dashboard/dashboard.dart';

class Parameters {
Expand Down Expand Up @@ -67,4 +68,9 @@ class Parameters {
static const int maxEntries = 3;

static const String appName = 'Altme';

static const DidKeyType didKeyTypeForEbsiV3 = DidKeyType.ebsiv3;
static const DidKeyType didKeyTypeForDefault = DidKeyType.edDSA;
static const DidKeyType didKeyTypeForDutch = DidKeyType.jwkP256;
static const DidKeyType didKeyTypeForOwfBaselineProfile = DidKeyType.jwkP256;
}
2 changes: 2 additions & 0 deletions lib/app/shared/constants/urls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class Urls {
'https://issuer.talao.co/passbase/endpoint/verifiableid/';
static const String identityCardUrlJWTVCJSON =
'https://talao.co/id360/oidc4vc/';
static const String identityCardUrlVCSDJWT =
'https://talao.co/id360/oidc4vc?format=vcsd-jwt&type=identitycredential';

static const String over18JWTVCJSON =
'https://talao.co/id360/oidc4vc?type=over18';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
return [VCFormatType.ldpVc];

case CredentialSubjectType.verifiableIdCard:
return [
VCFormatType.ldpVc,
VCFormatType.jwtVcJson,
VCFormatType.vcSdJWT,
];

case CredentialSubjectType.over18:
case CredentialSubjectType.livenessCard:
case CredentialSubjectType.emailPass:
Expand Down Expand Up @@ -839,8 +845,9 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
link = Urls.identityCardUrlJWTVCJSON;
case VCFormatType.jwtVc:
case VCFormatType.jwtVcJsonLd:
case VCFormatType.vcSdJWT:
link = '';
case VCFormatType.vcSdJWT:
link = Urls.identityCardUrlVCSDJWT;
}

whyGetThisCard =
Expand Down
1 change: 0 additions & 1 deletion lib/app/shared/enum/type/profile/profile.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export 'did_key_type.dart';
export 'profile_type.dart';
export 'subject_syntax.dart';
export 'wallet_app_type.dart';
16 changes: 13 additions & 3 deletions lib/app/shared/enum/type/profile/profile_type.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import 'package:altme/l10n/l10n.dart';

enum ProfileType { custom, ebsiV3, dutch, enterprise, owfBaselineProfile }
enum ProfileType {
custom,
ebsiV3,
dutch,
enterprise,
owfBaselineProfile,
defaultOne
}

extension ProfileTypeX on ProfileType {
String getTitle({
Expand All @@ -15,15 +22,18 @@ extension ProfileTypeX on ProfileType {
case ProfileType.dutch:
return l10n.decentralizedIdentityInteropProfile;
case ProfileType.enterprise:
return name.isEmpty ? 'Enterprise' : name;
return name.isEmpty ? l10n.enterprise : name;
case ProfileType.owfBaselineProfile:
return 'OWF Baseline Profile';
return l10n.oWFBaselineProfile;
case ProfileType.defaultOne:
return l10n.defaultProfile;
}
}

bool get showSponseredBy {
switch (this) {
case ProfileType.custom:
case ProfileType.defaultOne:
case ProfileType.dutch:
return false;
case ProfileType.ebsiV3:
Expand Down
8 changes: 0 additions & 8 deletions lib/app/shared/enum/type/profile/subject_syntax.dart

This file was deleted.

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 @@ -26,6 +26,7 @@ class WalletLogo extends StatelessWidget {
switch (profileModel.profileType) {
case ProfileType.custom:
case ProfileType.dutch:
case ProfileType.defaultOne:
image = flavorCubit.state == FlavorMode.development
? ImageStrings.appLogoDev
: flavorCubit.state == FlavorMode.staging
Expand Down
12 changes: 10 additions & 2 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,18 @@ class MaterialAppDefinition extends StatelessWidget {
create: (context) => LangCubit(),
child: BlocBuilder<LangCubit, Locale>(
builder: (context, lang) {
context.read<LangCubit>().fetchLocale();
if (isStaging) {
final locale = DevicePreview.locale(context);
if (locale != null) {
context.read<LangCubit>().setLocale(locale);
}
} else {
context.read<LangCubit>().fetchLocale();
}

return MaterialApp(
builder: isStaging ? DevicePreview.appBuilder : null,
locale: isStaging ? DevicePreview.locale(context) : lang,
locale: lang,
title: 'AltMe',
darkTheme: AppTheme.darkThemeData,
navigatorObservers: [MyRouteObserver(context)],
Expand Down
4 changes: 3 additions & 1 deletion lib/chat_room/cubit/chat_room_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ abstract class ChatRoomCubit extends Cubit<ChatRoomState> {
privateKey: jsonDecode(p256KeyForWallet) as Map<String, dynamic>,
did: '', // just added as it is required field
mediaType: MediaType.basic, // just added as it is required field
useJWKThumbPrint: true, // just added as it is required field
clientType:
ClientType.jwkThumbprint, // just added as it is required field
proofHeaderType: customOidc4vcProfile.proofHeader,
clientId: customOidc4vcProfile.clientId ?? '',
);

final helpCenterOptions =
Expand Down
3 changes: 2 additions & 1 deletion lib/credentials/cubit/credentials_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ class CredentialsCubit extends Cubit<CredentialsState> {
final displayVerifiableId = vcFormatType == VCFormatType.ldpVc &&
discoverCardsOptions.displayVerifiableId;
final displayVerifiableIdJwt =
vcFormatType == VCFormatType.jwtVcJson &&
(vcFormatType == VCFormatType.jwtVcJson ||
vcFormatType == VCFormatType.vcSdJWT) &&
discoverCardsOptions.displayVerifiableIdJwt;

if (displayVerifiableId || displayVerifiableIdJwt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Oidc4vcSettingMenuView extends StatelessWidget {
const SecurityLevelWidget(),
const DidKeyTypeWidget(),
const DraftTypeWidget(),
const SubjectSyntaxTypeWidget(),
const CredentialManifestSupportWidget(),
const CryptographicHolderBindingWidget(),
const ScopeParameterWidget(),
const ClientAuthenticationWidget(),
const ClientTypeWidget(),
const ClientCredentialsWidget(),
const VCFormatWidget(),
const ProofHeaderWidget(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/theme/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oidc4vc/oidc4vc.dart';

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

@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return OptionContainer(
title: l10n.clientTypeTitle,
subtitle: l10n.clientTypeSubtitle,
body: ListView.builder(
itemCount: ClientType.values.length,
shrinkWrap: true,
physics: const ScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
final clientType = ClientType.values[index];
return Column(
children: [
if (index != 0)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(
height: 0,
color: Theme.of(context).colorScheme.borderColor,
),
),
ListTile(
onTap: () {
context.read<ProfileCubit>().updateProfileSetting(
clientType: clientType,
);
},
shape: const RoundedRectangleBorder(
side: BorderSide(
color: Color(0xFFDDDDEE),
width: 0.5,
),
),
title: Text(
clientType.getTitle,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Theme.of(context).colorScheme.onPrimary,
),
),
trailing: Icon(
state.model.profileSetting.selfSovereignIdentityOptions
.customOidc4vcProfile.clientType ==
clientType
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: Sizes.icon2x,
color: Theme.of(context).colorScheme.onPrimary,
),
),
],
);
},
),
);
},
);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export 'client_authentication_widget.dart';
export 'client_credentials_widget.dart';
export 'client_type_widget.dart';
export 'credential_manifest_support.dart';
export 'cryptograhic_holder_binding.dart';
export 'did_key_type_widget.dart';
Expand All @@ -8,5 +9,4 @@ export 'option_container.dart';
export 'proof_header_widget.dart';
export 'scope_parameter.dart';
export 'security_level_widget.dart';
export 'subject_syntax_type_widget.dart';
export 'vc_format_widget.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ class ClaimsData extends StatelessWidget {
}
}

final locale = context.read<LangCubit>().state;

final localeString = '${locale.languageCode}-${locale.countryCode}';
final languageCode = context.read<LangCubit>().state.languageCode;

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -83,7 +81,7 @@ class ClaimsData extends StatelessWidget {
final display = displays.where((element) {
if (element is Map<String, dynamic> &&
element.containsKey('locale')) {
if (element['locale'] == localeString) {
if (element['locale'].toString().contains(languageCode)) {
return true;
} else if (element['locale'] == 'en-US') {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class CredentialSubjectData extends StatelessWidget {
if (credentialSubjectData == null) return Container();
if (credentialSubjectData is! Map<String, dynamic>) return Container();

final locale = context.read<LangCubit>().state;

final localeString = '${locale.languageCode}-${locale.countryCode}';
final languageCode = context.read<LangCubit>().state.languageCode;

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -63,7 +61,7 @@ class CredentialSubjectData extends StatelessWidget {
final display = displays.where((element) {
if (element is Map<String, dynamic> &&
element.containsKey('locale')) {
if (element['locale'] == localeString) {
if (element['locale'].toString().contains(languageCode)) {
return true;
} else if (element['locale'] == 'en-US') {
return true;
Expand Down
Loading

0 comments on commit a70f174

Please sign in to comment.