Skip to content

Commit

Permalink
October (#2906)
Browse files Browse the repository at this point in the history
* feat: Add switch to control notification #2869

* feat: Fix notification issue and make chat only custom

* Update notification room #2875

* feat: Move notification menu to differnt place #2869

* refactor: Update notification switch location #2869

* Issue with name.firstname, cf slack
#2880

* feat: Consider more constrainsts for presentation #2882

* feat: Consider more constrainsts for presentation #2882

* version update: 2.12.6+511

* Fix: All constraints considered #2882 and organise cred list alphabatically #2782

* feat: Improve vc details #2894

* refactor: Remove specified data #2894

* feat: Improve VC for SD-JWT with key binding data #2756

* feat: Remove jwt from json display in dev mode #2894

* feat: Add display log parameter #2895

* feat: Update wording for EBSI v3 #2896

* feat: Add new profile ebsi 4.0 #2897

* version update: 2.13.1+514

---------

Co-authored-by: Bibash Shrestha <[email protected]>
  • Loading branch information
hawkbee1 and bibash28 authored Sep 24, 2024
1 parent 017727f commit 39c29b9
Show file tree
Hide file tree
Showing 22 changed files with 387 additions and 105 deletions.
1 change: 1 addition & 0 deletions lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class Parameters {
static const String walletName = 'altme_wallet';

static const DidKeyType didKeyTypeForEbsiV3 = DidKeyType.ebsiv3;
static const DidKeyType didKeyTypeForEbsiV4 = DidKeyType.ebsiv4;
static const DidKeyType didKeyTypeForDefault = DidKeyType.edDSA;
static const DidKeyType didKeyTypeForDutch = DidKeyType.jwkP256;
static const DidKeyType didKeyTypeForOwfBaselineProfile = DidKeyType.jwkP256;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/shared/enum/type/oidc4vc_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum OIDC4VCType {
presentationPrefix: 'openid-hedera://',
),

EBSIV3(
EBSI(
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
),
Expand Down Expand Up @@ -44,7 +44,7 @@ extension OIDC4VCTypeX on OIDC4VCType {
case OIDC4VCType.DEFAULT:
case OIDC4VCType.GAIAX:
case OIDC4VCType.GREENCYPHER:
case OIDC4VCType.EBSIV3:
case OIDC4VCType.EBSI:
case OIDC4VCType.HAIP:
return true;
case OIDC4VCType.JWTVC:
Expand Down
6 changes: 6 additions & 0 deletions lib/app/shared/enum/type/profile/did_key_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum DidKeyType {
p256,
@JsonValue('did:key:ebsi')
ebsiv3,
ebsiv4,
@JsonValue('did:jwk:p-256')
jwkP256,
@JsonValue(
Expand All @@ -29,6 +30,8 @@ extension DidKeyTypeX on DidKeyType {
return 'did:key P-256';
case DidKeyType.ebsiv3:
return 'did:key EBSI-V3';
case DidKeyType.ebsiv4:
return 'did:key EBSI-V4';
case DidKeyType.jwkP256:
return 'did:jwk P-256';
case DidKeyType.jwtClientAttestation:
Expand All @@ -46,6 +49,8 @@ extension DidKeyTypeX on DidKeyType {
return l10n.keyDecentralizedIDP256;
case DidKeyType.ebsiv3:
return l10n.ebsiV3DecentralizedId;
case DidKeyType.ebsiv4:
return l10n.ebsiV4DecentralizedId;
case DidKeyType.jwkP256:
return l10n.jwkDecentralizedIDP256;
case DidKeyType.jwtClientAttestation:
Expand All @@ -62,6 +67,7 @@ extension DidKeyTypeX on DidKeyType {
case DidKeyType.edDSA:
return true;
case DidKeyType.ebsiv3:
case DidKeyType.ebsiv4:
return false;
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/app/shared/enum/type/profile/profile_type.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
enum ProfileType {
defaultOne,
ebsiV3,
ebsiV4,
diipv2point1,
diipv3,
custom,
Expand All @@ -13,7 +14,9 @@ extension ProfileTypeX on ProfileType {
case ProfileType.custom:
return 'Custom';
case ProfileType.ebsiV3:
return 'European Blockchain Services Infrastructure';
return 'European Blockchain Services Infrastructure (EBSI v3.x)';
case ProfileType.ebsiV4:
return 'European Blockchain Services Infrastructure (EBSI v4.x)';
case ProfileType.diipv2point1:
return 'Decentralized Identity Interop Profile (DIIP v2.1)';
case ProfileType.enterprise:
Expand All @@ -32,6 +35,7 @@ extension ProfileTypeX on ProfileType {
case ProfileType.diipv2point1:
return false;
case ProfileType.ebsiV3:
case ProfileType.ebsiV4:
case ProfileType.enterprise:
case ProfileType.diipv3:
return true;
Expand Down
33 changes: 18 additions & 15 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ String getDateTimeWithoutSpace({DateTime? dateTime}) {
}

int getIndexValue({
required bool isEBSIV3,
required bool isEBSI,
required DidKeyType didKeyType,
}) {
switch (didKeyType) {
case DidKeyType.secp256k1:
if (isEBSIV3) {
if (isEBSI) {
return 3;
} else {
return 1;
Expand All @@ -250,7 +250,8 @@ int getIndexValue({
return 5;
case DidKeyType.jwkP256:
return 6;

case DidKeyType.ebsiv4:
return 7;
case DidKeyType.edDSA:
case DidKeyType.jwtClientAttestation:
return 0; // it is not needed, just assigned
Expand Down Expand Up @@ -282,7 +283,7 @@ Future<String> getPrivateKey({

case DidKeyType.secp256k1:
final index = getIndexValue(
isEBSIV3: true,
isEBSI: true,
didKeyType: didKeyType,
);
final key = profileCubit.oidc4vc.privateKeyFromMnemonic(
Expand All @@ -293,9 +294,10 @@ Future<String> getPrivateKey({

case DidKeyType.p256:
case DidKeyType.ebsiv3:
case DidKeyType.ebsiv4:
case DidKeyType.jwkP256:
final indexValue = getIndexValue(
isEBSIV3: false,
isEBSI: false,
didKeyType: didKeyType,
);

Expand Down Expand Up @@ -398,9 +400,9 @@ DidKeyType? getDidKeyFromString(String? didKeyTypeString) {
Future<String> fetchPrivateKey({
required ProfileCubit profileCubit,
required DidKeyType didKeyType,
bool? isEBSIV3,
bool? isEBSI,
}) async {
if (isEBSIV3 != null && isEBSIV3) {
if (isEBSI != null && isEBSI) {
final privateKey = await getPrivateKey(
profileCubit: profileCubit,
didKeyType: DidKeyType.ebsiv3,
Expand Down Expand Up @@ -533,6 +535,7 @@ Future<(String, String)> getDidAndKid({

switch (didKeyType) {
case DidKeyType.ebsiv3:
case DidKeyType.ebsiv4:

//b'\xd1\xd6\x03' in python
final List<int> prefixByteList = [0xd1, 0xd6, 0x03];
Expand Down Expand Up @@ -592,11 +595,11 @@ Future<(String, String)> getDidAndKid({

Future<(String, String)> fetchDidAndKid({
required String privateKey,
bool? isEBSIV3,
bool? isEBSI,
required ProfileCubit profileCubit,
required DidKeyType didKeyType,
}) async {
if (isEBSIV3 != null && isEBSIV3) {
if (isEBSI != null && isEBSI) {
final (did, kid) = await getDidAndKid(
didKeyType: DidKeyType.ebsiv3,
privateKey: privateKey,
Expand Down Expand Up @@ -785,7 +788,7 @@ Future<
for (final oidc4vcType in OIDC4VCType.values) {
if (oidc4vcType.isEnabled && url.startsWith(oidc4vcType.offerPrefix)) {
if (oidc4vcType == OIDC4VCType.DEFAULT ||
oidc4vcType == OIDC4VCType.EBSIV3) {
oidc4vcType == OIDC4VCType.EBSI) {
if (credSupported?.trustFramework != null &&
credSupported == credSupported?.trustFramework) {
return (
Expand All @@ -801,7 +804,7 @@ Future<
if (credSupported?.trustFramework?.name != null &&
credSupported?.trustFramework?.name == 'ebsi') {
return (
OIDC4VCType.EBSIV3,
OIDC4VCType.EBSI,
openIdConfiguration,
authorizationServerConfiguration,
credentialOfferJson,
Expand Down Expand Up @@ -997,7 +1000,7 @@ Future<Map<String, dynamic>?> getClientMetada({
}
}

Future<bool?> isEBSIV3ForVerifiers({
Future<bool?> isEBSIForVerifiers({
required Uri uri,
required OIDC4VC oidc4vc,
required OIDC4VCIDraftType oidc4vciDraftType,
Expand Down Expand Up @@ -1595,7 +1598,7 @@ bool supportCryptoCredential(ProfileModel profileModel) {
// oAuthClientAttestationPop
Future<(String?, String?, String?, String?, String?)> getClientDetails({
required ProfileCubit profileCubit,
required bool isEBSIV3,
required bool isEBSI,
required String issuer,
}) async {
try {
Expand All @@ -1612,13 +1615,13 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({

final String privateKey = await fetchPrivateKey(
profileCubit: profileCubit,
isEBSIV3: isEBSIV3,
isEBSI: isEBSI,
didKeyType: didKeyType,
);

final (did, _) = await fetchDidAndKid(
privateKey: privateKey,
isEBSIV3: isEBSIV3,
isEBSI: isEBSI,
profileCubit: profileCubit,
didKeyType: didKeyType,
);
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 @@ -33,6 +33,7 @@ class WalletLogo extends StatelessWidget {
? ImageStrings.appLogoStage
: ImageStrings.appLogo;
case ProfileType.ebsiV3:
case ProfileType.ebsiV4:
image = ImageStrings.ebsiLogo;
case ProfileType.enterprise:
final isLightTheme =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DidKeyTypeWidget extends StatelessWidget {
VCFormatType.ldpVc;

final isUnmatchedDid = didKeyType == DidKeyType.ebsiv3 ||
didKeyType == DidKeyType.ebsiv4 ||
didKeyType == DidKeyType.jwkP256;

if (isldpVc && isUnmatchedDid) {
Expand Down
Loading

0 comments on commit 39c29b9

Please sign in to comment.