From aace929c4046d81302f8112c3c053b9773804750 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 13:07:15 +0545 Subject: [PATCH 1/6] feat: New profile Default #2385 --- .vscode/launch.json | 8 +- lib/app/shared/constants/parameters.dart | 6 + .../enum/type/profile/profile_type.dart | 16 +- lib/app/shared/widget/wallet_logo.dart | 1 + .../profile/cubit/profile_cubit.dart | 137 +++++++----------- lib/dashboard/profile/models/profile.dart | 80 +++++++++- .../profile/models/profile_setting.dart | 32 +++- lib/l10n/arb/app_en.arb | 5 +- lib/l10n/untranslated.json | 20 ++- .../helper_function/helper_function.dart | 3 + lib/onboarding/starter/view/starter_page.dart | 2 +- lib/wallet/cubit/wallet_cubit.dart | 2 +- pubspec.lock | 28 ++-- 13 files changed, 211 insertions(+), 129 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0ae10e8fa..b4e33cecb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -28,13 +28,7 @@ "request": "launch", "type": "dart", "program": "lib/main_production.dart", - "args": [ - "--flavor", - "production", - "--target", - "lib/main_production.dart", - "--release" - ] + "args": ["--flavor", "production", "--target", "lib/main_production.dart"] } ] } diff --git a/lib/app/shared/constants/parameters.dart b/lib/app/shared/constants/parameters.dart index 9a7a6f103..e48f5107f 100644 --- a/lib/app/shared/constants/parameters.dart +++ b/lib/app/shared/constants/parameters.dart @@ -1,3 +1,4 @@ +import 'package:altme/app/shared/enum/enum.dart'; import 'package:altme/dashboard/dashboard.dart'; class Parameters { @@ -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; } diff --git a/lib/app/shared/enum/type/profile/profile_type.dart b/lib/app/shared/enum/type/profile/profile_type.dart index 6db79dd0c..90104e4c3 100644 --- a/lib/app/shared/enum/type/profile/profile_type.dart +++ b/lib/app/shared/enum/type/profile/profile_type.dart @@ -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({ @@ -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: diff --git a/lib/app/shared/widget/wallet_logo.dart b/lib/app/shared/widget/wallet_logo.dart index 9f79b655a..41f58bdc4 100644 --- a/lib/app/shared/widget/wallet_logo.dart +++ b/lib/app/shared/widget/wallet_logo.dart @@ -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 diff --git a/lib/dashboard/profile/cubit/profile_cubit.dart b/lib/dashboard/profile/cubit/profile_cubit.dart index 626578322..8dc3f365f 100644 --- a/lib/dashboard/profile/cubit/profile_cubit.dart +++ b/lib/dashboard/profile/cubit/profile_cubit.dart @@ -58,6 +58,11 @@ class ProfileCubit extends Cubit { } Future load() async { + final ssiKey = await getSecureStorage.get(SecureStorageKeys.ssiKey); + if (ssiKey == null) { + return emit(state.copyWith(status: AppStatus.success)); + } + emit(state.loading()); final log = getLogger('ProfileCubit - load'); @@ -117,7 +122,7 @@ class ProfileCubit extends Cubit { /// profileType - var profileType = ProfileType.custom; + var profileType = ProfileType.defaultOne; final profileTypeString = await secureStorageProvider.get(SecureStorageKeys.profileType); @@ -134,90 +139,9 @@ class ProfileCubit extends Cubit { /// profileSetting late ProfileSetting profileSetting; - /// migration - remove later - final customProfileBackupValue = await secureStorageProvider.get( - 'customProfileBackup', - ); - - if (customProfileBackupValue != null) { - try { - final customProfileBackup = - json.decode(customProfileBackupValue) as Map; - - // // didKeyType: customProfileBackup.didKeyType, - - var didKeyType = DidKeyType.p256; - - if (customProfileBackup.containsKey('didKeyType')) { - for (final value in DidKeyType.values) { - if (value.toString() == - customProfileBackup.containsKey('didKeyType').toString()) { - didKeyType = value; - } - } - } - - profileSetting = ProfileSetting( - blockchainOptions: BlockchainOptions.initial(), - generalOptions: GeneralOptions.empty(), - helpCenterOptions: HelpCenterOptions.initial(), - selfSovereignIdentityOptions: SelfSovereignIdentityOptions( - displayManageDecentralizedId: true, - customOidc4vcProfile: CustomOidc4VcProfile( - clientAuthentication: customProfileBackup - .containsKey('useBasicClientAuthentication') && - customProfileBackup['useBasicClientAuthentication'] == - 'true' - ? ClientAuthentication.clientSecretBasic - : ClientAuthentication.none, - credentialManifestSupport: customProfileBackup - .containsKey('enableCredentialManifestSupport') && - customProfileBackup['enableCredentialManifestSupport'] == - 'true', - cryptoHolderBinding: customProfileBackup - .containsKey('enableCryptographicHolderBinding') && - customProfileBackup['enableCryptographicHolderBinding'] == - 'true', - defaultDid: didKeyType, - oidc4vciDraft: OIDC4VCIDraftType.draft11, - oidc4vpDraft: OIDC4VPDraftType.draft18, - scope: - customProfileBackup.containsKey('enableScopeParameter') && - customProfileBackup['enableScopeParameter'] == 'true', - securityLevel: - customProfileBackup.containsKey('enableSecurity') && - customProfileBackup['enableSecurity'] == 'true', - siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: - customProfileBackup.containsKey('enableJWKThumbprint') && - customProfileBackup['enableJWKThumbprint'] == 'true' - ? SubjectSyntax.jwkThumbprint - : SubjectSyntax.did, - clientId: customProfileBackup.containsKey('clientId') - ? customProfileBackup['clientId'].toString() - : Parameters.clientId, - clientSecret: customProfileBackup.containsKey('clientSecret') - ? customProfileBackup['clientSecret'].toString() - : randomString(12), - proofHeader: ProofHeaderType.kid, - ), - ), - settingsMenu: SettingsMenu.initial(), - version: '', - walletSecurityOptions: WalletSecurityOptions.initial(), - ); - } catch (e) { - await secureStorageProvider.delete('customProfileBackup'); - } - await secureStorageProvider.delete('customProfileBackup'); - } - - /// migration - remove upto here - late ProfileModel profileModel; /// based on profileType set the profile setting - switch (profileType) { case ProfileType.custom: final customProfileSettingJsonString = await secureStorageProvider @@ -255,15 +179,38 @@ class ProfileCubit extends Cubit { profileSetting: profileSetting, ); + case ProfileType.defaultOne: + final privateKey = await getPrivateKey( + secureStorage: secureStorageProvider, + didKeyType: Parameters.didKeyTypeForDefault, + oidc4vc: oidc4vc, + ); + + final (did, _) = await getDidAndKid( + didKeyType: Parameters.didKeyTypeForDefault, + privateKey: privateKey, + secureStorage: secureStorageProvider, + didKitProvider: didKitProvider, + ); + + profileModel = ProfileModel.defaultOne( + polygonIdNetwork: polygonIdNetwork, + walletType: walletType, + walletProtectionType: walletProtectionType, + isDeveloperMode: isDeveloperMode, + clientId: did, + clientSecret: randomString(12), + ); + case ProfileType.ebsiV3: final privateKey = await getPrivateKey( secureStorage: secureStorageProvider, - didKeyType: DidKeyType.ebsiv3, + didKeyType: Parameters.didKeyTypeForEbsiV3, oidc4vc: oidc4vc, ); final (did, _) = await getDidAndKid( - didKeyType: DidKeyType.ebsiv3, + didKeyType: Parameters.didKeyTypeForEbsiV3, privateKey: privateKey, secureStorage: secureStorageProvider, didKitProvider: didKitProvider, @@ -281,12 +228,12 @@ class ProfileCubit extends Cubit { case ProfileType.dutch: final privateKey = await getPrivateKey( secureStorage: secureStorageProvider, - didKeyType: DidKeyType.jwkP256, + didKeyType: Parameters.didKeyTypeForDutch, oidc4vc: oidc4vc, ); final (did, _) = await getDidAndKid( - didKeyType: DidKeyType.jwkP256, + didKeyType: Parameters.didKeyTypeForDutch, privateKey: privateKey, secureStorage: secureStorageProvider, didKitProvider: didKitProvider, @@ -304,12 +251,12 @@ class ProfileCubit extends Cubit { case ProfileType.owfBaselineProfile: final privateKey = await getPrivateKey( secureStorage: secureStorageProvider, - didKeyType: DidKeyType.p256, + didKeyType: Parameters.didKeyTypeForOwfBaselineProfile, oidc4vc: oidc4vc, ); final (did, _) = await getDidAndKid( - didKeyType: DidKeyType.p256, + didKeyType: Parameters.didKeyTypeForOwfBaselineProfile, privateKey: privateKey, secureStorage: secureStorageProvider, didKitProvider: didKitProvider, @@ -554,6 +501,20 @@ class ProfileCubit extends Cubit { .selfSovereignIdentityOptions.customOidc4vcProfile.clientSecret, ), ); + case ProfileType.defaultOne: + await update( + ProfileModel.defaultOne( + 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.dutch: await update( ProfileModel.dutch( diff --git a/lib/dashboard/profile/models/profile.dart b/lib/dashboard/profile/models/profile.dart index fd4102347..cf0d86105 100644 --- a/lib/dashboard/profile/models/profile.dart +++ b/lib/dashboard/profile/models/profile.dart @@ -50,14 +50,14 @@ class ProfileModel extends Equatable { blockchainOptions: BlockchainOptions.initial(), generalOptions: GeneralOptions.empty(), helpCenterOptions: HelpCenterOptions.initial(), - discoverCardsOptions: DiscoverCardsOptions.initial(), + discoverCardsOptions: DiscoverCardsOptions.none(), selfSovereignIdentityOptions: SelfSovereignIdentityOptions( displayManageDecentralizedId: true, customOidc4vcProfile: CustomOidc4VcProfile( clientAuthentication: ClientAuthentication.clientId, credentialManifestSupport: false, cryptoHolderBinding: true, - defaultDid: DidKeyType.ebsiv3, + defaultDid: Parameters.didKeyTypeForEbsiV3, oidc4vciDraft: OIDC4VCIDraftType.draft11, oidc4vpDraft: OIDC4VPDraftType.draft10, scope: false, @@ -76,6 +76,52 @@ class ProfileModel extends Equatable { ), ); + factory ProfileModel.defaultOne({ + 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.defaultOne, + profileSetting: ProfileSetting( + blockchainOptions: BlockchainOptions.initial(), + generalOptions: GeneralOptions.empty(), + helpCenterOptions: HelpCenterOptions.initial(), + discoverCardsOptions: DiscoverCardsOptions.initial(), + selfSovereignIdentityOptions: SelfSovereignIdentityOptions( + displayManageDecentralizedId: true, + customOidc4vcProfile: CustomOidc4VcProfile( + clientAuthentication: ClientAuthentication.clientId, + credentialManifestSupport: true, + cryptoHolderBinding: true, + defaultDid: Parameters.didKeyTypeForDefault, + oidc4vciDraft: OIDC4VCIDraftType.draft11, + oidc4vpDraft: OIDC4VPDraftType.draft18, + scope: false, + securityLevel: false, + proofHeader: ProofHeaderType.kid, // N/A + siopv2Draft: SIOPV2DraftType.draft12, + subjectSyntaxeType: SubjectSyntax.did, + clientId: clientId, + clientSecret: clientSecret, + vcFormatType: VCFormatType.ldpVc, + ), + ), + settingsMenu: SettingsMenu.initial(), + version: '', + walletSecurityOptions: WalletSecurityOptions.initial(), + ), + ); + factory ProfileModel.dutch({ required PolygonIdNetwork polygonIdNetwork, required WalletType walletType, @@ -96,14 +142,36 @@ class ProfileModel extends Equatable { blockchainOptions: BlockchainOptions.initial(), generalOptions: GeneralOptions.empty(), helpCenterOptions: HelpCenterOptions.initial(), - discoverCardsOptions: DiscoverCardsOptions.initial(), + discoverCardsOptions: const DiscoverCardsOptions( + displayDefi: false, + displayHumanity: false, + displayHumanityJwt: false, + displayOver13: false, + displayOver15: false, + displayOver18: false, + displayOver18Jwt: false, + displayOver21: false, + displayOver50: false, + displayChainborn: false, + displayTezotopia: false, + displayVerifiableId: true, + displayVerifiableIdJwt: true, + displayOver65: false, + displayEmailPass: true, + displayEmailPassJwt: true, + displayPhonePass: false, + displayPhonePassJwt: false, + displayAgeRange: false, + displayGender: false, + displayExternalIssuer: [], + ), selfSovereignIdentityOptions: SelfSovereignIdentityOptions( displayManageDecentralizedId: true, customOidc4vcProfile: CustomOidc4VcProfile( clientAuthentication: ClientAuthentication.clientId, credentialManifestSupport: false, cryptoHolderBinding: true, - defaultDid: DidKeyType.jwkP256, + defaultDid: Parameters.didKeyTypeForDutch, oidc4vciDraft: OIDC4VCIDraftType.draft11, oidc4vpDraft: OIDC4VPDraftType.draft10, scope: false, @@ -142,14 +210,14 @@ class ProfileModel extends Equatable { blockchainOptions: BlockchainOptions.initial(), generalOptions: GeneralOptions.empty(), helpCenterOptions: HelpCenterOptions.initial(), - discoverCardsOptions: DiscoverCardsOptions.initial(), + discoverCardsOptions: DiscoverCardsOptions.none(), selfSovereignIdentityOptions: SelfSovereignIdentityOptions( displayManageDecentralizedId: true, customOidc4vcProfile: CustomOidc4VcProfile( clientAuthentication: ClientAuthentication.clientId, credentialManifestSupport: true, cryptoHolderBinding: true, - defaultDid: DidKeyType.jwkP256, + defaultDid: Parameters.didKeyTypeForOwfBaselineProfile, oidc4vciDraft: OIDC4VCIDraftType.draft13, oidc4vpDraft: OIDC4VPDraftType.draft18, scope: false, diff --git a/lib/dashboard/profile/models/profile_setting.dart b/lib/dashboard/profile/models/profile_setting.dart index 62cdd2438..0c64f695b 100644 --- a/lib/dashboard/profile/models/profile_setting.dart +++ b/lib/dashboard/profile/models/profile_setting.dart @@ -195,12 +195,12 @@ class DiscoverCardsOptions extends Equatable { factory DiscoverCardsOptions.initial() => const DiscoverCardsOptions( displayDefi: true, - displayHumanity: false, - displayHumanityJwt: false, + displayHumanity: true, + displayHumanityJwt: true, displayOver13: false, - displayOver15: true, + displayOver15: false, displayOver18: true, - displayOver18Jwt: true, + displayOver18Jwt: false, displayOver21: false, displayOver50: false, displayChainborn: false, @@ -217,6 +217,30 @@ class DiscoverCardsOptions extends Equatable { displayExternalIssuer: [], ); + factory DiscoverCardsOptions.none() => const DiscoverCardsOptions( + displayDefi: false, + displayHumanity: false, + displayHumanityJwt: false, + displayOver13: false, + displayOver15: false, + displayOver18: false, + displayOver18Jwt: false, + displayOver21: false, + displayOver50: false, + displayChainborn: false, + displayTezotopia: false, + displayVerifiableId: false, + displayVerifiableIdJwt: false, + displayOver65: false, + displayEmailPass: false, + displayEmailPassJwt: false, + displayPhonePass: false, + displayPhonePassJwt: false, + displayAgeRange: false, + displayGender: false, + displayExternalIssuer: [], + ); + final bool displayDefi; final bool displayHumanity; final bool displayHumanityJwt; diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 6225d2b44..6ec5795a6 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -1035,5 +1035,8 @@ "walletProvider": "Wallet Provider", "theLdpFormatIsNotSupportedByThisDIDMethod": "The ldp_format is not supported by this DID method.", "switchOffCryptoHolderBindingForThatDIDMethod": "Switch off Crypto Holder Binding for that DID Method.", - "thisTypeProofCannotBeUsedWithThisVCFormat": "This type proof cannot be used with this VC Format." + "thisTypeProofCannotBeUsedWithThisVCFormat": "This type proof cannot be used with this VC Format.", + "enterprise": "Enterprise", + "oWFBaselineProfile": "OWF Baseline Profile", + "defaultProfile":"Default" } \ No newline at end of file diff --git a/lib/l10n/untranslated.json b/lib/l10n/untranslated.json index d165b86d7..33b2dd563 100644 --- a/lib/l10n/untranslated.json +++ b/lib/l10n/untranslated.json @@ -940,7 +940,10 @@ "walletProvider", "theLdpFormatIsNotSupportedByThisDIDMethod", "switchOffCryptoHolderBindingForThatDIDMethod", - "thisTypeProofCannotBeUsedWithThisVCFormat" + "thisTypeProofCannotBeUsedWithThisVCFormat", + "enterprise", + "oWFBaselineProfile", + "defaultProfile" ], "es": [ @@ -1884,7 +1887,10 @@ "walletProvider", "theLdpFormatIsNotSupportedByThisDIDMethod", "switchOffCryptoHolderBindingForThatDIDMethod", - "thisTypeProofCannotBeUsedWithThisVCFormat" + "thisTypeProofCannotBeUsedWithThisVCFormat", + "enterprise", + "oWFBaselineProfile", + "defaultProfile" ], "fr": [ @@ -2153,7 +2159,10 @@ "walletProvider", "theLdpFormatIsNotSupportedByThisDIDMethod", "switchOffCryptoHolderBindingForThatDIDMethod", - "thisTypeProofCannotBeUsedWithThisVCFormat" + "thisTypeProofCannotBeUsedWithThisVCFormat", + "enterprise", + "oWFBaselineProfile", + "defaultProfile" ], "it": [ @@ -3097,6 +3106,9 @@ "walletProvider", "theLdpFormatIsNotSupportedByThisDIDMethod", "switchOffCryptoHolderBindingForThatDIDMethod", - "thisTypeProofCannotBeUsedWithThisVCFormat" + "thisTypeProofCannotBeUsedWithThisVCFormat", + "enterprise", + "oWFBaselineProfile", + "defaultProfile" ] } diff --git a/lib/onboarding/helper_function/helper_function.dart b/lib/onboarding/helper_function/helper_function.dart index ae32a4780..37d85aa75 100644 --- a/lib/onboarding/helper_function/helper_function.dart +++ b/lib/onboarding/helper_function/helper_function.dart @@ -33,6 +33,9 @@ Future generateAccount({ await secureStorageProvider.set(SecureStorageKeys.ssiKey, ssiKey); + /// create profile + await profileCubit.load(); + /// what's new popup disabled splashCubit.disableWhatsNewPopUp(); diff --git a/lib/onboarding/starter/view/starter_page.dart b/lib/onboarding/starter/view/starter_page.dart index d80e10785..502cfe51a 100644 --- a/lib/onboarding/starter/view/starter_page.dart +++ b/lib/onboarding/starter/view/starter_page.dart @@ -69,7 +69,7 @@ class StarterPage extends StatelessWidget { ); await profileCubit.setProfileSetting( profileSetting: ProfileSetting.initial(), - profileType: ProfileType.custom, + profileType: ProfileType.defaultOne, ); await showDialog( context: context, diff --git a/lib/wallet/cubit/wallet_cubit.dart b/lib/wallet/cubit/wallet_cubit.dart index af9f22ae6..82439b810 100644 --- a/lib/wallet/cubit/wallet_cubit.dart +++ b/lib/wallet/cubit/wallet_cubit.dart @@ -30,7 +30,7 @@ class WalletCubit extends Cubit { final HomeCubit homeCubit; final KeyGenerator keyGenerator; final CredentialsCubit credentialsCubit; - WalletConnectCubit walletConnectCubit; + final WalletConnectCubit walletConnectCubit; final log = getLogger('WalletCubit'); diff --git a/pubspec.lock b/pubspec.lock index b4a52d252..9780e815d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -973,10 +973,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "30088ce826b5b9cfbf9e8bece34c716c8a59fa54461dcae1e4ac01a94639e762" + sha256: "21b085a1c185e46701373866144ced56cfb7a0c33f63c916bb8fe2d0c1491278" url: "https://pub.dev" source: hosted - version: "0.6.18+3" + version: "0.6.19" flutter_native_timezone: dependency: "direct main" description: @@ -1732,26 +1732,26 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: "3c84d49f0a5e1915364707159ab71f11b3b8a429532176d3a6248a45718ad4f9" + sha256: "74e962b7fad7ff75959161bb2c0ad8fe7f2568ee82621c9c2660b751146bfe44" url: "https://pub.dev" source: hosted - version: "11.2.1" + version: "11.3.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: a5ebaa420cee8fd880ef10dedd42c6b3f493e7dbe27d7e0a7e1798669373082a + sha256: "1acac6bae58144b442f11e66621c062aead9c99841093c38f5bcdcc24c1c3474" url: "https://pub.dev" source: hosted - version: "12.0.4" + version: "12.0.5" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: "6ca25ee52518a8a26e80aaefe3c71caf6e2dfd809c1b20900d0882df6faed36e" + sha256: bdafc6db74253abb63907f4e357302e6bb786ab41465e8635f362ee71fd8707b url: "https://pub.dev" source: hosted - version: "9.3.1" + version: "9.4.0" permission_handler_html: dependency: transitive description: @@ -1764,10 +1764,10 @@ packages: dependency: transitive description: name: permission_handler_platform_interface - sha256: "5c43148f2bfb6d14c5a8162c0a712afe891f2d847f35fcff29c406b37da43c3c" + sha256: "23dfba8447c076ab5be3dee9ceb66aad345c4a648f0cac292c77b1eb0e800b78" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.0" permission_handler_windows: dependency: transitive description: @@ -2240,10 +2240,10 @@ packages: dependency: transitive description: name: sqlite3 - sha256: c4a4c5a4b2a32e2d0f6837b33d7c91a67903891a5b7dbe706cf4b1f6b0c798c5 + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.0" stack_trace: dependency: transitive description: @@ -2409,10 +2409,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" + sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.0" url_launcher_ios: dependency: transitive description: From ba99d67c4af0d86c931e753f04dd287341337363 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 14:01:23 +0545 Subject: [PATCH 2/6] Handle language with language code only --- lib/app/view/app.dart | 12 ++++++++++-- .../credentials/detail/widgets/claims_data.dart | 6 ++---- .../detail/widgets/credential_subject_data.dart | 6 ++---- lib/lang/cubit/lang_cubit.dart | 8 +++++++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/app/view/app.dart b/lib/app/view/app.dart index dfc8ed035..55e6ab974 100644 --- a/lib/app/view/app.dart +++ b/lib/app/view/app.dart @@ -242,10 +242,18 @@ class MaterialAppDefinition extends StatelessWidget { create: (context) => LangCubit(), child: BlocBuilder( builder: (context, lang) { - context.read().fetchLocale(); + if (isStaging) { + final locale = DevicePreview.locale(context); + if (locale != null) { + context.read().setLocale(locale); + } + } else { + context.read().fetchLocale(); + } + return MaterialApp( builder: isStaging ? DevicePreview.appBuilder : null, - locale: isStaging ? DevicePreview.locale(context) : lang, + locale: lang, title: 'AltMe', darkTheme: AppTheme.darkThemeData, navigatorObservers: [MyRouteObserver(context)], diff --git a/lib/dashboard/home/tab_bar/credentials/detail/widgets/claims_data.dart b/lib/dashboard/home/tab_bar/credentials/detail/widgets/claims_data.dart index 8d806096b..54f015d5f 100644 --- a/lib/dashboard/home/tab_bar/credentials/detail/widgets/claims_data.dart +++ b/lib/dashboard/home/tab_bar/credentials/detail/widgets/claims_data.dart @@ -51,9 +51,7 @@ class ClaimsData extends StatelessWidget { } } - final locale = context.read().state; - - final localeString = '${locale.languageCode}-${locale.countryCode}'; + final languageCode = context.read().state.languageCode; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -83,7 +81,7 @@ class ClaimsData extends StatelessWidget { final display = displays.where((element) { if (element is Map && element.containsKey('locale')) { - if (element['locale'] == localeString) { + if (element['locale'].toString().contains(languageCode)) { return true; } else if (element['locale'] == 'en-US') { return true; diff --git a/lib/dashboard/home/tab_bar/credentials/detail/widgets/credential_subject_data.dart b/lib/dashboard/home/tab_bar/credentials/detail/widgets/credential_subject_data.dart index 7ff2f8398..5a68eb652 100644 --- a/lib/dashboard/home/tab_bar/credentials/detail/widgets/credential_subject_data.dart +++ b/lib/dashboard/home/tab_bar/credentials/detail/widgets/credential_subject_data.dart @@ -31,9 +31,7 @@ class CredentialSubjectData extends StatelessWidget { if (credentialSubjectData == null) return Container(); if (credentialSubjectData is! Map) return Container(); - final locale = context.read().state; - - final localeString = '${locale.languageCode}-${locale.countryCode}'; + final languageCode = context.read().state.languageCode; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -63,7 +61,7 @@ class CredentialSubjectData extends StatelessWidget { final display = displays.where((element) { if (element is Map && element.containsKey('locale')) { - if (element['locale'] == localeString) { + if (element['locale'].toString().contains(languageCode)) { return true; } else if (element['locale'] == 'en-US') { return true; diff --git a/lib/lang/cubit/lang_cubit.dart b/lib/lang/cubit/lang_cubit.dart index 1bc883ac1..2b509497b 100644 --- a/lib/lang/cubit/lang_cubit.dart +++ b/lib/lang/cubit/lang_cubit.dart @@ -14,7 +14,13 @@ class LangCubit extends Cubit { final langauageCode = locale!.languageCode; if (AppLocalizations.supportedLocales.contains(Locale(langauageCode))) { - emit(locale); + setLocale(locale); + } else { + setLocale(const Locale('en', 'US')); } } + + void setLocale(Locale locale) { + emit(locale); + } } From dcef6e67e024b7d16546bc95a3499b5601bc67f8 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 15:35:41 +0545 Subject: [PATCH 3/6] Value of the attribute iss of the Proof of key ownership in the credential request must be the value of client_id #2380 --- .../cubit/qr_code_scan_cubit.dart | 6 +-- lib/oidc4vc/get_and_add_credential.dart | 3 +- .../initiate_oidv4vc_credential_issuance.dart | 2 +- .../lib/src/issuer_token_parameters.dart | 4 ++ packages/oidc4vc/lib/src/oidc4vc.dart | 37 ++++++++++++++++--- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart index 4a7f473e0..2c7e674aa 100644 --- a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart +++ b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart @@ -1185,7 +1185,7 @@ class QRCodeScanCubit extends Cubit { codeForAuthorisedFlow: null, codeVerifier: null, authorization: authorization, - clientId: clientId, + clientId: clientId ?? '', clientSecret: clientSecret, ); } else { @@ -1221,7 +1221,7 @@ class QRCodeScanCubit extends Cubit { required String? codeForAuthorisedFlow, required String? codeVerifier, required String? authorization, - required String? clientId, + required String clientId, required String? clientSecret, }) async { try { @@ -1323,7 +1323,7 @@ class QRCodeScanCubit extends Cubit { codeForAuthorisedFlow: codeForAuthorisedFlow, codeVerifier: codeVerifier, authorization: authorization, - clientId: clientId, + clientId: clientId ?? '', clientSecret: clientSecret, ); } catch (e) { diff --git a/lib/oidc4vc/get_and_add_credential.dart b/lib/oidc4vc/get_and_add_credential.dart index cd102aadd..ce8d2a7fc 100644 --- a/lib/oidc4vc/get_and_add_credential.dart +++ b/lib/oidc4vc/get_and_add_credential.dart @@ -29,7 +29,7 @@ Future getAndAddCredential({ required String? authorization, required OIDC4VCIDraftType oidc4vciDraftType, required DidKeyType didKeyType, - required String? clientId, + required String clientId, required String? clientSecret, required JWTDecode jwtDecode, }) async { @@ -88,6 +88,7 @@ Future getAndAddCredential({ oidc4vciDraftType: oidc4vciDraftType, useJWKThumbPrint: enableJWKThumbprint, proofHeaderType: customOidc4vcProfile.proofHeader, + clientAuthentication: customOidc4vcProfile.clientAuthentication, ); for (int i = 0; i < encodedCredentialOrFutureTokens.length; i++) { diff --git a/lib/oidc4vc/initiate_oidv4vc_credential_issuance.dart b/lib/oidc4vc/initiate_oidv4vc_credential_issuance.dart index 0dfb29cab..e70fd2934 100644 --- a/lib/oidc4vc/initiate_oidv4vc_credential_issuance.dart +++ b/lib/oidc4vc/initiate_oidv4vc_credential_issuance.dart @@ -131,7 +131,7 @@ Future initiateOIDC4VCCredentialIssuance({ codeForAuthorisedFlow: codeForAuthorisedFlow, codeVerifier: codeVerifier, authorization: authorization, - clientId: clientId, + clientId: clientId ?? '', clientSecret: clientSecret, ); } diff --git a/packages/oidc4vc/lib/src/issuer_token_parameters.dart b/packages/oidc4vc/lib/src/issuer_token_parameters.dart index f8b6bcaff..09b167d91 100644 --- a/packages/oidc4vc/lib/src/issuer_token_parameters.dart +++ b/packages/oidc4vc/lib/src/issuer_token_parameters.dart @@ -11,9 +11,13 @@ class IssuerTokenParameters extends TokenParameters { required super.proofHeaderType, required super.useJWKThumbPrint, required this.issuer, + required this.clientId, super.kid, }); /// [issuer] is id of credential we are aquiring. final String issuer; + + /// [clientId] is clientId. + final String clientId; } diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index 83286ad0d..72f090149 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -341,7 +341,7 @@ class OIDC4VC { required String issuer, required dynamic credential, required String did, - required String? clientId, + required String clientId, required String? clientSecret, required String kid, required int indexValue, @@ -350,6 +350,7 @@ class OIDC4VC { required bool useJWKThumbPrint, required ProofHeaderType proofHeaderType, required OIDC4VCIDraftType oidc4vciDraftType, + required ClientAuthentication clientAuthentication, String? preAuthorizedCode, String? userPin, String? code, @@ -402,6 +403,7 @@ class OIDC4VC { mediaType: MediaType.proofOfOwnership, useJWKThumbPrint: useJWKThumbPrint, proofHeaderType: proofHeaderType, + clientId: clientId, ); String? deferredCredentialEndpoint; @@ -450,6 +452,7 @@ class OIDC4VC { cryptoHolderBinding: cryptoHolderBinding, oidc4vciDraftType: oidc4vciDraftType, credentialDefinition: credentialDefinition, + clientAuthentication: clientAuthentication, vct: vct, ); @@ -466,6 +469,7 @@ class OIDC4VC { cryptoHolderBinding: cryptoHolderBinding, oidc4vciDraftType: oidc4vciDraftType, credentialDefinition: credentialDefinition, + clientAuthentication: clientAuthentication, vct: vct, credentialIdentifier: null, ); @@ -489,6 +493,7 @@ class OIDC4VC { required String format, required bool cryptoHolderBinding, required OIDC4VCIDraftType oidc4vciDraftType, + required ClientAuthentication clientAuthentication, required String? credentialIdentifier, required Map? credentialDefinition, required String? vct, @@ -504,6 +509,7 @@ class OIDC4VC { cryptoHolderBinding: cryptoHolderBinding, oidc4vciDraftType: oidc4vciDraftType, credentialDefinition: credentialDefinition, + clientAuthentication: clientAuthentication, vct: vct, ); @@ -758,6 +764,7 @@ class OIDC4VC { required String format, required bool cryptoHolderBinding, required OIDC4VCIDraftType oidc4vciDraftType, + required ClientAuthentication clientAuthentication, required String? credentialIdentifier, required String? cnonce, required String? vct, @@ -766,7 +773,12 @@ class OIDC4VC { final credentialData = {}; if (cryptoHolderBinding) { - final vcJwt = await getIssuerJwt(issuerTokenParameters, cnonce); + final vcJwt = await getIssuerJwt( + tokenParameters: issuerTokenParameters, + clientAuthentication: clientAuthentication, + oidc4vciDraftType: oidc4vciDraftType, + cnonce: cnonce, + ); credentialData['proof'] = { 'proof_type': 'jwt', 'jwt': vcJwt, @@ -1030,13 +1042,26 @@ class OIDC4VC { } @visibleForTesting - Future getIssuerJwt( - IssuerTokenParameters tokenParameters, + Future getIssuerJwt({ + required IssuerTokenParameters tokenParameters, + required ClientAuthentication clientAuthentication, + required OIDC4VCIDraftType oidc4vciDraftType, String? cnonce, - ) async { + }) async { final iat = (DateTime.now().millisecondsSinceEpoch / 1000).round(); + + var iss = tokenParameters.did; + + if (clientAuthentication == ClientAuthentication.clientSecretPost || + clientAuthentication == ClientAuthentication.clientSecretBasic) { + if (oidc4vciDraftType == OIDC4VCIDraftType.draft11 || + oidc4vciDraftType == OIDC4VCIDraftType.draft13) { + iss = tokenParameters.clientId; + } + } + final payload = { - 'iss': tokenParameters.did, + 'iss': iss, 'iat': iat, 'aud': tokenParameters.issuer, }; From cae1232b89307ed3495a013285064e3a84b3c73d Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 17:33:22 +0545 Subject: [PATCH 4/6] feat: Several changes for switch client type #2381 --- .vscode/launch.json | 8 +- lib/app/shared/enum/type/profile/profile.dart | 1 - .../enum/type/profile/subject_syntax.dart | 8 -- lib/chat_room/cubit/chat_room_cubit.dart | 4 +- .../view/oidc4vc_settings_menu.dart | 2 +- .../widget/client_type_widget.dart | 73 +++++++++++++++++++ .../widget/subject_syntax_type_widget.dart | 34 --------- .../ssi/oidc4vc_settngs/widget/widget.dart | 2 +- .../profile/cubit/profile_cubit.dart | 4 +- lib/dashboard/profile/models/profile.dart | 8 +- .../profile/models/profile_setting.dart | 13 ++-- .../cubit/qr_code_scan_cubit.dart | 19 ++--- lib/l10n/arb/app_en.arb | 4 +- lib/l10n/untranslated.json | 16 ++-- lib/oidc4vc/get_and_add_credential.dart | 5 +- .../cubit/initialization_cubit.dart | 6 +- lib/scan/cubit/scan_cubit.dart | 5 +- packages/oidc4vc/lib/oidc4vc.dart | 1 + packages/oidc4vc/lib/src/client_type.dart | 23 ++++++ .../lib/src/issuer_token_parameters.dart | 7 +- packages/oidc4vc/lib/src/oidc4vc.dart | 47 +++++++----- .../oidc4vc/lib/src/token_parameters.dart | 10 ++- .../lib/src/verifier_token_parameters.dart | 5 +- pubspec.lock | 4 +- 24 files changed, 189 insertions(+), 120 deletions(-) delete mode 100644 lib/app/shared/enum/type/profile/subject_syntax.dart create mode 100644 lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/client_type_widget.dart delete mode 100644 lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/subject_syntax_type_widget.dart create mode 100644 packages/oidc4vc/lib/src/client_type.dart diff --git a/.vscode/launch.json b/.vscode/launch.json index b4e33cecb..0ae10e8fa 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -28,7 +28,13 @@ "request": "launch", "type": "dart", "program": "lib/main_production.dart", - "args": ["--flavor", "production", "--target", "lib/main_production.dart"] + "args": [ + "--flavor", + "production", + "--target", + "lib/main_production.dart", + "--release" + ] } ] } diff --git a/lib/app/shared/enum/type/profile/profile.dart b/lib/app/shared/enum/type/profile/profile.dart index 38619749c..b52373de9 100644 --- a/lib/app/shared/enum/type/profile/profile.dart +++ b/lib/app/shared/enum/type/profile/profile.dart @@ -1,4 +1,3 @@ export 'did_key_type.dart'; export 'profile_type.dart'; -export 'subject_syntax.dart'; export 'wallet_app_type.dart'; diff --git a/lib/app/shared/enum/type/profile/subject_syntax.dart b/lib/app/shared/enum/type/profile/subject_syntax.dart deleted file mode 100644 index 72a06c5d6..000000000 --- a/lib/app/shared/enum/type/profile/subject_syntax.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -enum SubjectSyntax { - @JsonValue('urn:ietf:params:oauth:jwk-thumbprint') - jwkThumbprint, - - did, -} diff --git a/lib/chat_room/cubit/chat_room_cubit.dart b/lib/chat_room/cubit/chat_room_cubit.dart index 301d1294c..ee43d9d3a 100644 --- a/lib/chat_room/cubit/chat_room_cubit.dart +++ b/lib/chat_room/cubit/chat_room_cubit.dart @@ -273,8 +273,10 @@ abstract class ChatRoomCubit extends Cubit { privateKey: jsonDecode(p256KeyForWallet) as Map, 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 = 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 38f8078b0..87b667cfb 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 @@ -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(), diff --git a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/client_type_widget.dart b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/client_type_widget.dart new file mode 100644 index 000000000..d154ccbef --- /dev/null +++ b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/client_type_widget.dart @@ -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( + 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().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, + ), + ), + ], + ); + }, + ), + ); + }, + ); + } +} diff --git a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/subject_syntax_type_widget.dart b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/subject_syntax_type_widget.dart deleted file mode 100644 index 66eac25e1..000000000 --- a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/subject_syntax_type_widget.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:altme/app/app.dart'; -import 'package:altme/dashboard/dashboard.dart'; -import 'package:altme/l10n/l10n.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; - -class SubjectSyntaxTypeWidget extends StatelessWidget { - const SubjectSyntaxTypeWidget({super.key}); - - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - return BlocBuilder( - builder: (context, state) { - return OptionContainer( - title: l10n.subjectSyntaxType, - subtitle: l10n.enableToUseTheJWKThumprintOfTheKey, - body: Switch( - onChanged: (value) async { - await context.read().updateProfileSetting( - subjectSyntax: - value ? SubjectSyntax.jwkThumbprint : SubjectSyntax.did, - ); - }, - value: state.model.profileSetting.selfSovereignIdentityOptions - .customOidc4vcProfile.subjectSyntaxeType == - SubjectSyntax.jwkThumbprint, - 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 de2ca74d6..22a8f1a9d 100644 --- a/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart +++ b/lib/dashboard/drawer/ssi/oidc4vc_settngs/widget/widget.dart @@ -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'; @@ -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'; diff --git a/lib/dashboard/profile/cubit/profile_cubit.dart b/lib/dashboard/profile/cubit/profile_cubit.dart index 8dc3f365f..83b5d4f74 100644 --- a/lib/dashboard/profile/cubit/profile_cubit.dart +++ b/lib/dashboard/profile/cubit/profile_cubit.dart @@ -407,7 +407,7 @@ class ProfileCubit extends Cubit { bool? secureSecurityAuthenticationWithPinCode, bool? verifySecurityIssuerWebsiteIdentity, OIDC4VCIDraftType? oidc4vciDraftType, - SubjectSyntax? subjectSyntax, + ClientType? clientType, VCFormatType? vcFormatType, ProofHeaderType? proofHeaderType, }) async { @@ -436,7 +436,7 @@ class ProfileCubit extends Cubit { clientId: clientId, clientSecret: clientSecret, oidc4vciDraft: oidc4vciDraftType, - subjectSyntaxeType: subjectSyntax, + clientType: clientType, vcFormatType: vcFormatType, ), ), diff --git a/lib/dashboard/profile/models/profile.dart b/lib/dashboard/profile/models/profile.dart index cf0d86105..cb8a102d7 100644 --- a/lib/dashboard/profile/models/profile.dart +++ b/lib/dashboard/profile/models/profile.dart @@ -64,7 +64,7 @@ class ProfileModel extends Equatable { securityLevel: false, proofHeader: ProofHeaderType.kid, siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: SubjectSyntax.did, + clientType: ClientType.did, clientId: clientId, clientSecret: clientSecret, vcFormatType: VCFormatType.jwtVc, @@ -110,7 +110,7 @@ class ProfileModel extends Equatable { securityLevel: false, proofHeader: ProofHeaderType.kid, // N/A siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: SubjectSyntax.did, + clientType: ClientType.did, clientId: clientId, clientSecret: clientSecret, vcFormatType: VCFormatType.ldpVc, @@ -178,7 +178,7 @@ class ProfileModel extends Equatable { securityLevel: false, proofHeader: ProofHeaderType.kid, siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: SubjectSyntax.did, + clientType: ClientType.did, clientId: clientId, clientSecret: clientSecret, vcFormatType: VCFormatType.jwtVcJson, @@ -224,7 +224,7 @@ class ProfileModel extends Equatable { securityLevel: false, proofHeader: ProofHeaderType.kid, siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: SubjectSyntax.did, + clientType: ClientType.did, clientId: clientId, clientSecret: clientSecret, vcFormatType: VCFormatType.vcSdJWT, diff --git a/lib/dashboard/profile/models/profile_setting.dart b/lib/dashboard/profile/models/profile_setting.dart index 0c64f695b..ee63fea74 100644 --- a/lib/dashboard/profile/models/profile_setting.dart +++ b/lib/dashboard/profile/models/profile_setting.dart @@ -541,7 +541,7 @@ class CustomOidc4VcProfile extends Equatable { required this.scope, required this.securityLevel, required this.siopv2Draft, - required this.subjectSyntaxeType, + required this.clientType, required this.clientId, required this.clientSecret, this.vcFormatType = VCFormatType.ldpVc, @@ -559,7 +559,7 @@ class CustomOidc4VcProfile extends Equatable { proofHeader: ProofHeaderType.kid, securityLevel: false, siopv2Draft: SIOPV2DraftType.draft12, - subjectSyntaxeType: SubjectSyntax.did, + clientType: ClientType.did, clientId: Parameters.clientId, clientSecret: randomString(12), vcFormatType: VCFormatType.ldpVc, @@ -582,7 +582,8 @@ class CustomOidc4VcProfile extends Equatable { final ProofHeaderType proofHeader; final bool securityLevel; final SIOPV2DraftType siopv2Draft; - final SubjectSyntax subjectSyntaxeType; + @JsonKey(name: 'subjectSyntaxeType') + final ClientType clientType; @JsonKey(name: 'vcFormat') final VCFormatType vcFormatType; @@ -601,7 +602,7 @@ class CustomOidc4VcProfile extends Equatable { ProofHeaderType? proofHeader, bool? securityLevel, SIOPV2DraftType? siopv2Draft, - SubjectSyntax? subjectSyntaxeType, + ClientType? clientType, VCFormatType? vcFormatType, }) => CustomOidc4VcProfile( @@ -616,7 +617,7 @@ class CustomOidc4VcProfile extends Equatable { proofHeader: proofHeader ?? this.proofHeader, securityLevel: securityLevel ?? this.securityLevel, siopv2Draft: siopv2Draft ?? this.siopv2Draft, - subjectSyntaxeType: subjectSyntaxeType ?? this.subjectSyntaxeType, + clientType: clientType ?? this.clientType, clientId: clientId ?? this.clientId, clientSecret: clientSecret ?? this.clientSecret, vcFormatType: vcFormatType ?? this.vcFormatType, @@ -636,7 +637,7 @@ class CustomOidc4VcProfile extends Equatable { proofHeader, securityLevel, siopv2Draft, - subjectSyntaxeType, + clientType, vcFormatType, ]; } diff --git a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart index 2c7e674aa..52dfaa4ba 100644 --- a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart +++ b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart @@ -991,7 +991,7 @@ class QRCodeScanCubit extends Cubit { final isSecurityEnabled = customOidc4vcProfile.securityLevel; final enableJWKThumbprint = - customOidc4vcProfile.subjectSyntaxeType == SubjectSyntax.jwkThumbprint; + customOidc4vcProfile.clientType == ClientType.jwkThumbprint; if (isSecurityEnabled && enableJWKThumbprint) { final Map payload = @@ -1065,9 +1065,6 @@ class QRCodeScanCubit extends Cubit { final customOidc4vcProfile = profileCubit.state.model.profileSetting .selfSovereignIdentityOptions.customOidc4vcProfile; - final enableJWKThumbprint = customOidc4vcProfile.subjectSyntaxeType == - SubjectSyntax.jwkThumbprint; - final Response response = await oidc4vc.siopv2Flow( clientId: clientId, privateKey: privateKey, @@ -1076,7 +1073,7 @@ class QRCodeScanCubit extends Cubit { redirectUri: redirectUri!, nonce: nonce, stateValue: stateValue, - useJWKThumbPrint: enableJWKThumbprint, + clientType: customOidc4vcProfile.clientType, proofHeaderType: customOidc4vcProfile.proofHeader, ); @@ -1159,19 +1156,23 @@ class QRCodeScanCubit extends Cubit { secureStorage: secureStorageProvider, didKeyType: didKeyType, ); - switch (customOidc4vcProfile.subjectSyntaxeType) { - case SubjectSyntax.jwkThumbprint: + switch (customOidc4vcProfile.clientType) { + case ClientType.jwkThumbprint: final tokenParameters = TokenParameters( privateKey: jsonDecode(privateKey) as Map, 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: '', ); clientId = tokenParameters.thumbprint; - case SubjectSyntax.did: + case ClientType.did: clientId = did; + case ClientType.confidential: + clientId = customOidc4vcProfile.clientId; } } diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 6ec5795a6..fe06ee47a 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -968,8 +968,8 @@ "jwkDecentralizedIDP256": "JWK Decentralized ID P-256", "defaultDid": "Default DID", "selectOneOfTheDid": "Select one of the DIDs", - "subjectSyntaxType": "Subject Syntax Type", - "enableToUseTheJWKThumprintOfTheKey": "Default: DID\nEnable to use the JWK thumprint of the key", + "clientTypeTitle": "OIDC4VCI Client Type", + "clientTypeSubtitle": "Default: DID\nSwitch to change the client type", "cryptographicHolderBinding": "Cryptographic Holder Binding", "cryptographicHolderBindingSubtitle": "Default : On\nDisable cryptographic binding for claim based binding credentials.", "scopeParameters": "Scope Parameters", diff --git a/lib/l10n/untranslated.json b/lib/l10n/untranslated.json index 33b2dd563..0cba527bd 100644 --- a/lib/l10n/untranslated.json +++ b/lib/l10n/untranslated.json @@ -874,8 +874,8 @@ "jwkDecentralizedIDP256", "defaultDid", "selectOneOfTheDid", - "subjectSyntaxType", - "enableToUseTheJWKThumprintOfTheKey", + "clientTypeTitle", + "clientTypeSubtitle", "cryptographicHolderBinding", "cryptographicHolderBindingSubtitle", "scopeParameters", @@ -1821,8 +1821,8 @@ "jwkDecentralizedIDP256", "defaultDid", "selectOneOfTheDid", - "subjectSyntaxType", - "enableToUseTheJWKThumprintOfTheKey", + "clientTypeTitle", + "clientTypeSubtitle", "cryptographicHolderBinding", "cryptographicHolderBindingSubtitle", "scopeParameters", @@ -2093,8 +2093,8 @@ "jwkDecentralizedIDP256", "defaultDid", "selectOneOfTheDid", - "subjectSyntaxType", - "enableToUseTheJWKThumprintOfTheKey", + "clientTypeTitle", + "clientTypeSubtitle", "cryptographicHolderBinding", "cryptographicHolderBindingSubtitle", "scopeParameters", @@ -3040,8 +3040,8 @@ "jwkDecentralizedIDP256", "defaultDid", "selectOneOfTheDid", - "subjectSyntaxType", - "enableToUseTheJWKThumprintOfTheKey", + "clientTypeTitle", + "clientTypeSubtitle", "cryptographicHolderBinding", "cryptographicHolderBindingSubtitle", "scopeParameters", diff --git a/lib/oidc4vc/get_and_add_credential.dart b/lib/oidc4vc/get_and_add_credential.dart index ce8d2a7fc..590117e9a 100644 --- a/lib/oidc4vc/get_and_add_credential.dart +++ b/lib/oidc4vc/get_and_add_credential.dart @@ -60,9 +60,6 @@ Future getAndAddCredential({ final customOidc4vcProfile = profileCubit.state.model.profileSetting .selfSovereignIdentityOptions.customOidc4vcProfile; - final enableJWKThumbprint = - customOidc4vcProfile.subjectSyntaxeType == SubjectSyntax.jwkThumbprint; - final index = getIndexValue(isEBSIV3: isEBSIV3, didKeyType: didKeyType); final ( @@ -86,7 +83,7 @@ Future getAndAddCredential({ cryptoHolderBinding: cryptoHolderBinding, authorization: authorization, oidc4vciDraftType: oidc4vciDraftType, - useJWKThumbPrint: enableJWKThumbprint, + clientType: customOidc4vcProfile.clientType, proofHeaderType: customOidc4vcProfile.proofHeader, clientAuthentication: customOidc4vcProfile.clientAuthentication, ); diff --git a/lib/onboarding/enterprise/initialization/cubit/initialization_cubit.dart b/lib/onboarding/enterprise/initialization/cubit/initialization_cubit.dart index baee2ab98..d95d5e757 100644 --- a/lib/onboarding/enterprise/initialization/cubit/initialization_cubit.dart +++ b/lib/onboarding/enterprise/initialization/cubit/initialization_cubit.dart @@ -217,16 +217,14 @@ class EnterpriseInitializationCubit final customOidc4vcProfile = profileCubit.state.model.profileSetting .selfSovereignIdentityOptions.customOidc4vcProfile; - final enableJWKThumbprint = - customOidc4vcProfile.subjectSyntaxeType == SubjectSyntax.jwkThumbprint; - final tokenParameters = TokenParameters( privateKey: privateKey, did: '', kid: null, mediaType: MediaType.walletAttestation, - useJWKThumbPrint: enableJWKThumbprint, + clientType: customOidc4vcProfile.clientType, proofHeaderType: customOidc4vcProfile.proofHeader, + clientId: customOidc4vcProfile.clientId ?? '', ); final thumbPrint = tokenParameters.thumbprint; diff --git a/lib/scan/cubit/scan_cubit.dart b/lib/scan/cubit/scan_cubit.dart index c0591ebd9..1931048d6 100644 --- a/lib/scan/cubit/scan_cubit.dart +++ b/lib/scan/cubit/scan_cubit.dart @@ -894,9 +894,6 @@ class ScanCubit extends Cubit { final customOidc4vcProfile = profileCubit.state.model.profileSetting .selfSovereignIdentityOptions.customOidc4vcProfile; - final enableJWKThumbprint = - customOidc4vcProfile.subjectSyntaxeType == SubjectSyntax.jwkThumbprint; - final idToken = await oidc4vc.extractIdToken( clientId: clientId, credentialsToBePresented: credentialList, @@ -904,7 +901,7 @@ class ScanCubit extends Cubit { kid: kid, privateKey: privateKey, nonce: nonce, - useJWKThumbPrint: enableJWKThumbprint, + clientType: customOidc4vcProfile.clientType, proofHeaderType: customOidc4vcProfile.proofHeader, ); diff --git a/packages/oidc4vc/lib/oidc4vc.dart b/packages/oidc4vc/lib/oidc4vc.dart index 3eda045ad..1540301b2 100644 --- a/packages/oidc4vc/lib/oidc4vc.dart +++ b/packages/oidc4vc/lib/oidc4vc.dart @@ -9,6 +9,7 @@ library ebsi; export 'src/client_authentication.dart'; +export 'src/client_type.dart'; export 'src/issuer_token_parameters.dart'; export 'src/media_type.dart'; export 'src/models/models.dart'; diff --git a/packages/oidc4vc/lib/src/client_type.dart b/packages/oidc4vc/lib/src/client_type.dart new file mode 100644 index 000000000..466a3352c --- /dev/null +++ b/packages/oidc4vc/lib/src/client_type.dart @@ -0,0 +1,23 @@ +import 'package:json_annotation/json_annotation.dart'; + +enum ClientType { + @JsonValue('urn:ietf:params:oauth:jwk-thumbprint') + jwkThumbprint, + + did, + + confidential, +} + +extension ClientTypeX on ClientType { + String get getTitle { + switch (this) { + case ClientType.jwkThumbprint: + return 'JWK Thumbprint'; + case ClientType.did: + return 'DID'; + case ClientType.confidential: + return 'Confidential Client'; + } + } +} diff --git a/packages/oidc4vc/lib/src/issuer_token_parameters.dart b/packages/oidc4vc/lib/src/issuer_token_parameters.dart index 09b167d91..289e7cb1a 100644 --- a/packages/oidc4vc/lib/src/issuer_token_parameters.dart +++ b/packages/oidc4vc/lib/src/issuer_token_parameters.dart @@ -9,15 +9,12 @@ class IssuerTokenParameters extends TokenParameters { required super.did, required super.mediaType, required super.proofHeaderType, - required super.useJWKThumbPrint, + required super.clientType, + required super.clientId, required this.issuer, - required this.clientId, super.kid, }); /// [issuer] is id of credential we are aquiring. final String issuer; - - /// [clientId] is clientId. - final String clientId; } diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index 72f090149..ca5bf54e7 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -324,7 +324,7 @@ class OIDC4VC { ], 'subject_syntax_types_discriminations': [ 'did:key:jwk_jcs-pub', - 'did:ebsi:v1' + 'did:ebsi:v1', ], 'subject_trust_frameworks_supported': ['ebsi'], 'id_token_types_supported': ['subject_signed_id_token'], @@ -347,7 +347,7 @@ class OIDC4VC { required int indexValue, required String privateKey, required bool cryptoHolderBinding, - required bool useJWKThumbPrint, + required ClientType clientType, required ProofHeaderType proofHeaderType, required OIDC4VCIDraftType oidc4vciDraftType, required ClientAuthentication clientAuthentication, @@ -401,7 +401,7 @@ class OIDC4VC { kid: kid, issuer: issuer, mediaType: MediaType.proofOfOwnership, - useJWKThumbPrint: useJWKThumbPrint, + clientType: clientType, proofHeaderType: proofHeaderType, clientId: clientId, ); @@ -1178,8 +1178,9 @@ class OIDC4VC { credentials: credentialsToBePresented, nonce: nonce, mediaType: MediaType.basic, - useJWKThumbPrint: false, + clientType: ClientType.did, proofHeaderType: proofHeaderType, + clientId: clientId, ); final vpToken = await getVpToken(tokenParameters); @@ -1196,7 +1197,7 @@ class OIDC4VC { required String did, required String kid, required String nonce, - required bool useJWKThumbPrint, + required ClientType clientType, required String privateKey, required ProofHeaderType proofHeaderType, }) async { @@ -1210,8 +1211,9 @@ class OIDC4VC { credentials: credentialsToBePresented, nonce: nonce, mediaType: MediaType.basic, - useJWKThumbPrint: useJWKThumbPrint, + clientType: clientType, proofHeaderType: proofHeaderType, + clientId: clientId, ); final verifierIdToken = await getIdToken(tokenParameters); @@ -1230,7 +1232,7 @@ class OIDC4VC { required String? nonce, required String privateKey, required String? stateValue, - required bool useJWKThumbPrint, + required ClientType clientType, required ProofHeaderType proofHeaderType, }) async { try { @@ -1244,8 +1246,9 @@ class OIDC4VC { credentials: [], nonce: nonce, mediaType: MediaType.basic, - useJWKThumbPrint: useJWKThumbPrint, + clientType: clientType, proofHeaderType: proofHeaderType, + clientId: clientId, ); // structures @@ -1338,12 +1341,11 @@ class OIDC4VC { switch (tokenParameters.proofHeaderType) { case ProofHeaderType.kid: - if (!tokenParameters.useJWKThumbPrint) { - vpBuilder.setProtectedHeader( - 'kid', - tokenParameters.kid ?? tokenParameters.thumbprint, - ); - } + vpBuilder.setProtectedHeader( + 'kid', + tokenParameters.kid ?? tokenParameters.thumbprint, + ); + case ProofHeaderType.jwk: vpBuilder.setProtectedHeader( 'jwk', @@ -1362,9 +1364,18 @@ class OIDC4VC { @visibleForTesting Future getIdToken(VerifierTokenParameters tokenParameters) async { /// build id token - final issAndSub = tokenParameters.useJWKThumbPrint - ? tokenParameters.thumbprint - : tokenParameters.did; + + var issAndSub = tokenParameters.thumbprint; + + switch (tokenParameters.clientType) { + case ClientType.jwkThumbprint: + issAndSub = tokenParameters.thumbprint; + case ClientType.did: + issAndSub = tokenParameters.did; + case ClientType.confidential: + issAndSub = tokenParameters.clientId; + } + final iat = (DateTime.now().millisecondsSinceEpoch / 1000).round(); final payload = { 'iat': iat, @@ -1378,7 +1389,7 @@ class OIDC4VC { payload['nonce'] = tokenParameters.nonce!; } - if (tokenParameters.useJWKThumbPrint) { + if (tokenParameters.clientType == ClientType.jwkThumbprint) { payload['sub_jwk'] = tokenParameters.publicJWK; } diff --git a/packages/oidc4vc/lib/src/token_parameters.dart b/packages/oidc4vc/lib/src/token_parameters.dart index d6906a24f..3460973da 100644 --- a/packages/oidc4vc/lib/src/token_parameters.dart +++ b/packages/oidc4vc/lib/src/token_parameters.dart @@ -14,13 +14,17 @@ class TokenParameters { required this.did, required this.mediaType, required this.proofHeaderType, - required this.useJWKThumbPrint, + required this.clientType, + required this.clientId, this.kid, }); /// [privateKey] is JWK (Json Web Key) of user private key final Map privateKey; + /// [clientId] is clientId. + final String clientId; + /// [did] did String did; @@ -47,8 +51,8 @@ class TokenParameters { return privateKey['crv'] == 'P-256' ? 'ES256' : 'ES256K'; } - /// whether to use did or thumbprint - bool useJWKThumbPrint; + /// client type + ClientType clientType; /// [thumbprint] of JWK as defined in https://www.rfc-editor.org/rfc/rfc7638 String get thumbprint { diff --git a/packages/oidc4vc/lib/src/verifier_token_parameters.dart b/packages/oidc4vc/lib/src/verifier_token_parameters.dart index 7e6b54a4f..216806cc6 100644 --- a/packages/oidc4vc/lib/src/verifier_token_parameters.dart +++ b/packages/oidc4vc/lib/src/verifier_token_parameters.dart @@ -11,9 +11,10 @@ class VerifierTokenParameters extends TokenParameters { required super.did, required super.proofHeaderType, required super.mediaType, - required this.audience, - required super.useJWKThumbPrint, + required super.clientType, + required super.clientId, required this.credentials, + required this.audience, this.nonce, super.kid, }); diff --git a/pubspec.lock b/pubspec.lock index 9780e815d..8bd37bdf7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1485,10 +1485,10 @@ packages: dependency: "direct main" description: name: matrix - sha256: "187390203f6a5a7370490b7036f2defc306fda240f8d744191d406692c128469" + sha256: "90e8743a3836414751400ecb24c9b41a20472b316f77010dc4ddcf300d511906" url: "https://pub.dev" source: hosted - version: "0.25.8" + version: "0.25.9" matrix_api_lite: dependency: transitive description: From 8d74ac03e7d8cfa6bcb3529d79a2d016cd8861ba Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 18:30:00 +0545 Subject: [PATCH 5/6] feat: Add issuer VerifiableID in Discover for profile OWF Baseline with vc+sd-jwt #2384 --- lib/app/shared/constants/urls.dart | 2 ++ .../credential_subject_type_extension.dart | 9 ++++++- lib/credentials/cubit/credentials_cubit.dart | 3 ++- lib/dashboard/profile/models/profile.dart | 24 ++++++++++++++++++- .../cubit/kyc_verification_cubit.dart | 22 ++++++++++------- 5 files changed, 49 insertions(+), 11 deletions(-) diff --git a/lib/app/shared/constants/urls.dart b/lib/app/shared/constants/urls.dart index 099997679..799a27bd2 100644 --- a/lib/app/shared/constants/urls.dart +++ b/lib/app/shared/constants/urls.dart @@ -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'; diff --git a/lib/app/shared/enum/type/credential_subject_type/credential_subject_type_extension.dart b/lib/app/shared/enum/type/credential_subject_type/credential_subject_type_extension.dart index f67a19693..cf9340d99 100644 --- a/lib/app/shared/enum/type/credential_subject_type/credential_subject_type_extension.dart +++ b/lib/app/shared/enum/type/credential_subject_type/credential_subject_type_extension.dart @@ -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: @@ -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 = diff --git a/lib/credentials/cubit/credentials_cubit.dart b/lib/credentials/cubit/credentials_cubit.dart index 2061c38dd..17a273f56 100644 --- a/lib/credentials/cubit/credentials_cubit.dart +++ b/lib/credentials/cubit/credentials_cubit.dart @@ -632,7 +632,8 @@ class CredentialsCubit extends Cubit { final displayVerifiableId = vcFormatType == VCFormatType.ldpVc && discoverCardsOptions.displayVerifiableId; final displayVerifiableIdJwt = - vcFormatType == VCFormatType.jwtVcJson && + (vcFormatType == VCFormatType.jwtVcJson || + vcFormatType == VCFormatType.vcSdJWT) && discoverCardsOptions.displayVerifiableIdJwt; if (displayVerifiableId || displayVerifiableIdJwt) { diff --git a/lib/dashboard/profile/models/profile.dart b/lib/dashboard/profile/models/profile.dart index cb8a102d7..cb36a8122 100644 --- a/lib/dashboard/profile/models/profile.dart +++ b/lib/dashboard/profile/models/profile.dart @@ -210,7 +210,29 @@ class ProfileModel extends Equatable { blockchainOptions: BlockchainOptions.initial(), generalOptions: GeneralOptions.empty(), helpCenterOptions: HelpCenterOptions.initial(), - discoverCardsOptions: DiscoverCardsOptions.none(), + discoverCardsOptions: const DiscoverCardsOptions( + displayDefi: false, + displayHumanity: false, + displayHumanityJwt: false, + displayOver13: false, + displayOver15: false, + displayOver18: false, + displayOver18Jwt: false, + displayOver21: false, + displayOver50: false, + displayChainborn: false, + displayTezotopia: false, + displayVerifiableId: false, + displayVerifiableIdJwt: true, + displayOver65: false, + displayEmailPass: false, + displayEmailPassJwt: false, + displayPhonePass: false, + displayPhonePassJwt: false, + displayAgeRange: false, + displayGender: false, + displayExternalIssuer: [], + ), selfSovereignIdentityOptions: SelfSovereignIdentityOptions( displayManageDecentralizedId: true, customOidc4vcProfile: CustomOidc4VcProfile( diff --git a/lib/kyc_verification/cubit/kyc_verification_cubit.dart b/lib/kyc_verification/cubit/kyc_verification_cubit.dart index 213b81bdb..184792815 100644 --- a/lib/kyc_verification/cubit/kyc_verification_cubit.dart +++ b/lib/kyc_verification/cubit/kyc_verification_cubit.dart @@ -71,10 +71,14 @@ class KycVerificationCubit extends Cubit { required String link, dynamic Function()? onKycApproved, }) async { - await startKycVerifcation(vcType: vcType); + await startKycVerifcation( + vcType: vcType, + link: link, + ); } Future startKycVerifcation({ + String? link, KycVcType vcType = KycVcType.verifiableId, }) async { emit(state.copyWith(status: KycVerificationStatus.loading)); @@ -85,13 +89,15 @@ class KycVerificationCubit extends Cubit { } //emit(state.copyWith(status: KycVerificationStatus.pending)); const walletId = AltMeStrings.clientIdForID360; - final url = '${Urls.authenticateForId360}/$code?vc_type=${vcType.value}' - '&client_id=$walletId&callback=${Urls.appDeepLink}'; - await LaunchUrl.launchUri( - Uri.parse( - url, - ), - ); + late String url; + + if (link == null) { + url = '${Urls.authenticateForId360}/$code?vc_type=${vcType.value}' + '&client_id=$walletId&callback=${Urls.appDeepLink}'; + } else { + url = link; + } + await LaunchUrl.launchUri(Uri.parse(url)); emit(state.copyWith(status: KycVerificationStatus.unkown)); } } From 8f9c8a4fee884d06d485e9931f0f7ae6e7b748c2 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 14 Feb 2024 18:32:46 +0545 Subject: [PATCH 6/6] update version 2.2.24+386 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index bcb123225..2d76addc7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: altme description: AltMe Flutter App -version: 2.2.23+385 +version: 2.2.24+386 environment: sdk: ">=3.1.0 <4.0.0"