Skip to content

Commit

Permalink
Merge branch 'main' into TALAO
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Oct 25, 2024
2 parents 8458248 + 0c938a2 commit adf9a9e
Show file tree
Hide file tree
Showing 37 changed files with 734 additions and 576 deletions.
41 changes: 15 additions & 26 deletions lib/app/shared/constants/constants_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,18 @@ abstract class ConstantsJson {
};

static const walletMetadataForIssuers = <String, dynamic>{
'client_name': Parameters.walletName,
'authorization_endpoint': Parameters.authorizationEndPoint,
'response_types_supported': ['vp_token', 'id_token'],
'vp_formats_supported': {
'jwt_vp': {
'alg': ['ES256', 'ES256K', 'EdDSA'],
},
'jwt_vc': {
'alg': ['ES256', 'ES256K', 'EdDSA'],
'jwt_vc_json': {
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'],
},
'jwt_vp_json': {
'alg': ['ES256', 'ES256K', 'EdDSA'],
},
'jwt_vc_json': {
'alg': ['ES256', 'ES256K', 'EdDSA'],
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'],
},
'vc+sd-jwt': {
'alg': ['ES256', 'ES256K', 'EdDSA'],
'alg_values_supported': ['ES256', 'ES256K', 'EdDSA'],
},
'ldp_vp': {
'proof_type': [
Expand All @@ -336,23 +333,15 @@ abstract class ConstantsJson {
],
},
},
'grant_types': ['authorization code', 'pre-authorized_code'],
'redirect_uris': [Parameters.authorizationEndPoint],
'subject_syntax_types_supported': ['did:key', 'did:jwk'],
'subject_syntax_types_discriminations': [
'did:key:jwk_jcs-pub',
'did:ebsi:v1',
],
'token_endpoint_auth_method_supported': [
'none',
'client_id',
'client_secret_post',
'client_secret_basic',
'client_secret_jwt',
'client_id_schemes_supported': [
'did',
'redirect_uri',
'x509_san_dns',
'verifier_attestation'
],
'credential_offer_endpoint': ['openid-credential-offer://', 'haip://'],
'client_name': '${Parameters.appName} wallet',
'contacts': ['contact@talao.io'],
'request_object_signing_alg_values_supported': ['ES256', 'ES256K', 'EdDSA'],
'presentation_definition_uri_supported': true,
'contacts': ['contact@talao.io']
};

static const walletMetadataForVerifiers = <String, dynamic>{
Expand Down
13 changes: 4 additions & 9 deletions lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Parameters {

// 'false' for talao
// 'true' for altme
static const bool importAtOnboarding = false;
static const bool importAndRestoreAtOnboarding = false;

// false for talao
// 'true' for altme
Expand All @@ -104,19 +104,14 @@ class Parameters {
// true for altme
static const bool showTezotopiaCard = true;

//'https://app.talao.co/app/download/authorize' for Talao
// 'https://app.altme.io/app/download/authorize' for altme
static const String redirectUri =
'https://app.talao.co/app/download/authorize';

//'https://app.talao.co/app/download/callback' for Talao
// 'https://app.altme.io/app/download/callback' for altme
static const String authorizationEndPoint =
'https://app.talao.co/app/download/callback';

// 'talao_wallet'for talao
// 'altme_wallet' for altme
static const String walletName = 'talao_wallet';
// 'Talao_wallet'for talao
// 'Altme_wallet' for altme
static const String walletName = 'Talao_wallet';

// 'https://app.talao.co/wallet_issuer'for talao
// 'https://app.altme.io/wallet_issuer' for altme
Expand Down
1 change: 1 addition & 0 deletions lib/app/shared/enum/type/restore_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum RestoreType { cryptoWallet, appBackup }
1 change: 1 addition & 0 deletions lib/app/shared/enum/type/type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export 'message_type/message_type.dart';
export 'oidc4vc_type.dart';
export 'profile/did_key_type.dart';
export 'profile/profile.dart';
export 'restore_type.dart';
export 'wallet_protection_type.dart';
export 'wallet_provider_type.dart';
export 'wallet_route_type.dart';
Expand Down
174 changes: 45 additions & 129 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ Future<String> getFormattedStringOIDC4VPSIOPV2({
final data = '''
<b>SCHEME :</b> ${getSchemeFromUrl(url)}\n
<b>AUTHORIZATION REQUEST :</b>
${response != null ? const JsonEncoder.withIndent(' ').convert(response) : 'None'}\n
${response != null ? const JsonEncoder.withIndent(' ').convert(response) : Uri.decodeComponent(url)}\n
<b>CLIENT METADATA :</b>
${clientMetaData != null ? const JsonEncoder.withIndent(' ').convert(clientMetaData) : 'None'}\n
<b>PRESENTATION DEFINITION :</b>
Expand Down Expand Up @@ -1802,7 +1802,7 @@ List<String> getStringCredentialsForToken({
}

//(presentLdpVc, presentJwtVc, presentJwtVcJson, presentVcSdJwt)
(bool, bool, bool, bool) getPresentVCDetails({
List<VCFormatType> getPresentVCDetails({
required VCFormatType vcFormatType,
required PresentationDefinition presentationDefinition,
required Map<String, dynamic>? clientMetaData,
Expand All @@ -1811,154 +1811,70 @@ List<String> getStringCredentialsForToken({
bool presentLdpVc = false;
bool presentJwtVc = false;
bool presentJwtVcJson = false;
bool presentJwtVcJsonLd = false;
bool presentVcSdJwt = false;

if (vcFormatType == VCFormatType.auto) {
final credential = credentialsToBePresented.firstOrNull;
final supportingFormats = <VCFormatType>[];

if (credential == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'VC format is missing',
},
);
}
if (presentationDefinition.format != null) {
final format = presentationDefinition.format;

/// ldp_vc
presentLdpVc = format?.ldpVc != null || format?.ldpVp != null;

final credentialFormat = credential.getFormat;
/// jwt_vc
presentJwtVc = format?.jwtVc != null || format?.jwtVp != null;

if (credentialFormat == VCFormatType.ldpVc.vcValue) {
/// jwt_vc_json
presentJwtVcJson = format?.jwtVcJson != null || format?.jwtVpJson != null;

/// vc+sd-jwt
presentVcSdJwt = format?.vcSdJwt != null;
} else {
if (clientMetaData == null) {
/// credential manifest case
presentLdpVc = true;
presentJwtVc = false;
presentJwtVcJson = false;
presentVcSdJwt = false;
} else if (credentialFormat == VCFormatType.jwtVc.vcValue) {
presentLdpVc = false;
presentJwtVc = true;
presentJwtVcJson = false;
presentVcSdJwt = false;
} else if (credentialFormat == VCFormatType.jwtVcJson.vcValue) {
presentLdpVc = false;
presentJwtVc = false;
presentJwtVcJson = true;
presentVcSdJwt = false;
} else if (credentialFormat == VCFormatType.vcSdJWT.vcValue) {
presentLdpVc = false;
presentJwtVc = false;
presentJwtVcJson = false;
presentJwtVcJsonLd = true;
presentVcSdJwt = true;
}
} else {
final supportingFormats = <String>[];

if (presentationDefinition.format != null) {
final format = presentationDefinition.format;
} else {
final vpFormats = clientMetaData['vp_formats'] as Map<String, dynamic>;

/// ldp_vc
presentLdpVc = format?.ldpVc != null || format?.ldpVp != null;
presentLdpVc = vpFormats.containsKey('ldp_vc');

/// jwt_vc
presentJwtVc = format?.jwtVc != null || format?.jwtVp != null;
presentJwtVc = vpFormats.containsKey('jwt_vc');

/// jwt_vc_json
presentJwtVcJson = format?.jwtVcJson != null || format?.jwtVpJson != null;

/// vc+sd-jwt
presentVcSdJwt = format?.vcSdJwt != null;
} else {
if (clientMetaData == null) {
/// credential manifest case
if (vcFormatType == VCFormatType.ldpVc) {
presentLdpVc = true;
} else if (vcFormatType == VCFormatType.jwtVc) {
presentJwtVc = true;
} else if (vcFormatType == VCFormatType.jwtVcJson) {
presentJwtVcJson = true;
} else if (vcFormatType == VCFormatType.vcSdJWT) {
presentVcSdJwt = true;
}
} else {
final vpFormats = clientMetaData['vp_formats'] as Map<String, dynamic>;

/// ldp_vc
presentLdpVc = vpFormats.containsKey('ldp_vc');

/// jwt_vc
presentJwtVc = vpFormats.containsKey('jwt_vc');

/// jwt_vc_json
presentJwtVcJson = vpFormats.containsKey('jwt_vc_json');

/// vc+sd-jwt
presentVcSdJwt = vpFormats.containsKey('vc+sd-jwt');
}
if (!presentLdpVc && vcFormatType == VCFormatType.ldpVc) {
presentLdpVc = true;
} else if (!presentJwtVc && vcFormatType == VCFormatType.jwtVc) {
presentJwtVc = true;
} else if (!presentJwtVcJson && vcFormatType == VCFormatType.jwtVcJson) {
presentJwtVcJson = true;
} else if (!presentVcSdJwt && vcFormatType == VCFormatType.vcSdJWT) {
presentVcSdJwt = true;
}
}
presentJwtVcJson = vpFormats.containsKey('jwt_vc_json');

if (!presentLdpVc &&
!presentJwtVc &&
!presentJwtVcJson &&
!presentVcSdJwt) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'VC format is missing',
},
);
}

/// create list of supported formats
if (presentLdpVc) supportingFormats.add(VCFormatType.ldpVc.vcValue);
if (presentJwtVc) supportingFormats.add(VCFormatType.jwtVc.vcValue);
if (presentJwtVcJson) supportingFormats.add(VCFormatType.jwtVcJson.vcValue);
if (presentVcSdJwt) supportingFormats.add(VCFormatType.vcSdJWT.vcValue);
/// jwt_vc_json-ld
presentJwtVcJson = vpFormats.containsKey('jwt_vc_json-ld');

/// make sure only one of all are true
if (presentLdpVc && vcFormatType == VCFormatType.ldpVc) {
presentLdpVc = true;
presentJwtVc = false;
presentJwtVcJson = false;
presentVcSdJwt = false;
} else if (presentJwtVc && vcFormatType == VCFormatType.jwtVc) {
presentLdpVc = false;
presentJwtVc = true;
presentJwtVcJson = false;
presentVcSdJwt = false;
} else if (presentJwtVcJson && vcFormatType == VCFormatType.jwtVcJson) {
presentLdpVc = false;
presentJwtVc = false;
presentJwtVcJson = true;
presentVcSdJwt = false;
} else if (presentVcSdJwt && vcFormatType == VCFormatType.vcSdJWT) {
presentLdpVc = false;
presentJwtVc = false;
presentJwtVcJson = false;
presentVcSdJwt = true;
/// vc+sd-jwt
presentVcSdJwt = vpFormats.containsKey('vc+sd-jwt');
}
}

if ((presentLdpVc && vcFormatType != VCFormatType.ldpVc) ||
(presentJwtVc && vcFormatType != VCFormatType.jwtVc) ||
presentJwtVcJson && vcFormatType != VCFormatType.jwtVcJson ||
presentVcSdJwt && vcFormatType != VCFormatType.vcSdJWT) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Please switch to profile that supports format '
'${supportingFormats.join('/')}.',
},
);
}
if (!presentLdpVc && !presentJwtVc && !presentJwtVcJson && !presentVcSdJwt) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'VC format is missing',
},
);
}

return (presentLdpVc, presentJwtVc, presentJwtVcJson, presentVcSdJwt);
/// create list of supported formats
if (presentLdpVc) supportingFormats.add(VCFormatType.ldpVc);
if (presentJwtVc) supportingFormats.add(VCFormatType.jwtVc);
if (presentJwtVcJson) supportingFormats.add(VCFormatType.jwtVcJson);
if (presentJwtVcJsonLd) supportingFormats.add(VCFormatType.jwtVcJsonLd);
if (presentVcSdJwt) supportingFormats.add(VCFormatType.vcSdJWT);

return supportingFormats;
}

List<dynamic> collectSdValues(Map<String, dynamic> data) {
Expand Down
1 change: 1 addition & 0 deletions lib/app/shared/message_handler/response_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ class ResponseMessage with MessageHandler {
case ResponseString
.RESPONSE_STRING_invalidPresentationDefinitionUriErrorDescription:
return ResponseString
// ignore: lines_longer_than_80_chars
.RESPONSE_STRING_invalidPresentationDefinitionUriErrorDescription
.localise(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,23 @@ class HelpCenterView extends StatelessWidget {
),
],
DrawerItem(
title: l10n.faqs,
onTap: () {
Navigator.of(context).push<void>(FAQsPage.route());
LaunchUrl.launch('https://doc.wallet-provider.io/welcome');
},
title: l10n.documentation,
),
DrawerItem(
onTap: () {
LaunchUrl.launch('https://${AltMeStrings.appContactWebsiteName}');
},
title: l10n.officialWebsite,
),
// DrawerItem(
// title: l10n.faqs,
// onTap: () {
// Navigator.of(context).push<void>(FAQsPage.route());
// },
// ),
// DrawerItem(
// onTap: () {
// LaunchUrl.launch('https://${AltMeStrings.appContactWebsiteName}');
// },
// title: l10n.officialWebsite,
// ),
],
),
);
Expand Down
21 changes: 12 additions & 9 deletions lib/dashboard/drawer/src/view/drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,18 @@ class DrawerView extends StatelessWidget {
},
),
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.activityLog,
subTitle: l10n.activityLogDescription,
onClick: () {
Navigator.of(context)
.push<void>(ActivityLogPage.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
if (profileModel
.profileSetting.settingsMenu.displayActivityLog) ...[
DrawerCategoryItem(
title: l10n.activityLog,
subTitle: l10n.activityLogDescription,
onClick: () {
Navigator.of(context)
.push<void>(ActivityLogPage.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],
DrawerCategoryItem(
title: l10n.resetWallet,
subTitle: l10n.resetWalletDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class BackupCredentialView extends StatelessWidget {
),
const SizedBox(height: Sizes.spaceXLarge),
Text(
Parameters.importAtOnboarding
Parameters.importAndRestoreAtOnboarding
? l10n.saveBackupCredentialSubtitle
: l10n.saveBackupCredentialSubtitle2,
textAlign: TextAlign.center,
Expand Down
Loading

0 comments on commit adf9a9e

Please sign in to comment.