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 Nov 27, 2023
2 parents 2aabe9c + 80c58ca commit f80b65a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 34 deletions.
6 changes: 2 additions & 4 deletions lib/dashboard/profile/cubit/profile_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,10 @@ class ProfileCubit extends Cubit<ProfileState> {
);
final ebsiV3Profile = ProfileModel.EbsiV3();
final profileModel = state.model.copyWith(
isDeveloperMode: ebsiV3Profile.isDeveloperMode,
isEbsiV3Profile: enabled,
enableSecurity: ebsiV3Profile.enableSecurity,
enable4DigitPINCode: ebsiV3Profile.enable4DigitPINCode,
enableJWKThumbprint: ebsiV3Profile.enable4DigitPINCode,
enableJWKThumbprint: ebsiV3Profile.enableJWKThumbprint,
enableCryptographicHolderBinding:
ebsiV3Profile.enableCryptographicHolderBinding,
didKeyType: ebsiV3Profile.didKeyType,
Expand All @@ -466,11 +465,10 @@ class ProfileCubit extends Cubit<ProfileState> {
json.decode(customProfileBackupValue) as Map<String, dynamic>,
);
final profileModel = state.model.copyWith(
isDeveloperMode: customProfileBackup.isDeveloperMode,
isEbsiV3Profile: enabled,
enableSecurity: customProfileBackup.enableSecurity,
enable4DigitPINCode: customProfileBackup.enable4DigitPINCode,
enableJWKThumbprint: customProfileBackup.enable4DigitPINCode,
enableJWKThumbprint: customProfileBackup.enableJWKThumbprint,
enableCryptographicHolderBinding:
customProfileBackup.enableCryptographicHolderBinding,
didKeyType: customProfileBackup.didKeyType,
Expand Down
50 changes: 21 additions & 29 deletions lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import 'package:json_annotation/json_annotation.dart';
import 'package:jwt_decode/jwt_decode.dart';
import 'package:oidc4vc/oidc4vc.dart';
import 'package:secure_storage/secure_storage.dart';
import 'package:uuid/uuid.dart';

part 'qr_code_scan_cubit.g.dart';
part 'qr_code_scan_state.dart';
Expand Down Expand Up @@ -717,10 +716,8 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {

final url = credentialModel.pendingInfo!.url;

OIDC4VCType? currentOIIDC4VCTypeForIssuance;

final (
OIDC4VCType? oidc4vcType,
_,
Map<String, dynamic>? openidConfigurationResponse,
Map<String, dynamic>? authorizationServerConfiguration,
_,
Expand All @@ -729,8 +726,6 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
client: client,
);

currentOIIDC4VCTypeForIssuance = oidc4vcType;

if (openidConfigurationResponse != null) {
await handleErrorForOID4VCI(
url: url,
Expand All @@ -739,28 +734,12 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
);
}

if (currentOIIDC4VCTypeForIssuance != null) {
await getAndAddDefferedCredential(
credentialModel: credentialModel,
credentialsCubit: credentialsCubit,
dioClient: client,
oidc4vc: oidc4vc,
);
} else if (credentialModel.pendingInfo!.url
.startsWith(Parameters.authorizeEndPoint)) {
await getAndAddDefferedCredential(
credentialModel: credentialModel,
credentialsCubit: credentialsCubit,
dioClient: client,
oidc4vc: oidc4vc,
);
} else {
emitError(
ResponseMessage(
message: ResponseString.RESPONSE_STRING_thisRequestIsNotSupported,
),
);
}
await getAndAddDefferedCredential(
credentialModel: credentialModel,
credentialsCubit: credentialsCubit,
dioClient: client,
oidc4vc: oidc4vc,
);
} catch (e) {
emitError(e);
}
Expand Down Expand Up @@ -1094,7 +1073,20 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
clientId = profileCubit.state.model.clientId;
clientSecret = profileCubit.state.model.clientSecret;
} else {
clientId = const Uuid().v4();
final privateKey = await fetchPrivateKey(
oidc4vc: oidc4vc,
secureStorage: secureStorageProvider,
isEBSIV3: isEBSIV3,
);

final (did, _) = await fetchDidAndKid(
privateKey: privateKey,
isEBSIV3: isEBSIV3,
didKitProvider: didKitProvider,
secureStorage: secureStorageProvider,
);
clientId = did;
//clientId = const Uuid().v4();
}

await getAuthorizationUriForIssuer(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: altme
description: AltMe Flutter App
version: 1.25.0+321
version: 1.25.2+322

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down

0 comments on commit f80b65a

Please sign in to comment.