Skip to content

Commit

Permalink
Solve test 10 issue #2576
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 10, 2024
1 parent f9b2774 commit b32c634
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
15 changes: 14 additions & 1 deletion lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1881,9 +1881,22 @@ Future<Map<String, dynamic>?> checkX509({

Future<Map<String, dynamic>?> checkVerifierAttestation({
required String clientId,
required Map<String, dynamic> payload,
required Map<String, dynamic> header,
required JWTDecode jwtDecode,
}) async {
final jwt = header['jwt'];

if (jwt == null) {
throw ResponseMessage(
data: {
'error': 'invalid_format',
'error_description': 'verifier_attestation scheme error',
},
);
}

final payload = jwtDecode.parseJwt(jwt.toString());

final sub = payload['sub'];
final cnf = payload['cnf'];

Expand Down
13 changes: 1 addition & 12 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 @@ -1101,21 +1101,10 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
header: header,
);
} else if (clientIdScheme == 'verifier_attestation') {
final jwt = header['jwt'];

if (jwt == null) {
throw ResponseMessage(
data: {
'error': 'invalid_format',
'error_description': 'verifier_attestation scheme error',
},
);
}

publicKeyJwk = await checkVerifierAttestation(
clientId: clientId,
payload: payload,
header: header,
jwtDecode: jwtDecode,
);
}
}
Expand Down
12 changes: 2 additions & 10 deletions lib/scan/cubit/scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -761,17 +761,9 @@ class ScanCubit extends Cubit<ScanState> {
final vcFormatType = profileSetting
.selfSovereignIdentityOptions.customOidc4vcProfile.vcFormatType;

if (vcFormat == null) {
if (vcFormatType == VCFormatType.ldpVc) {
vcFormat = 'ldp_vc';
} else if (vcFormatType == VCFormatType.jwtVc) {
vcFormat = 'jwt_vc';
} else if (vcFormatType == VCFormatType.jwtVcJson) {
vcFormat = 'jwt_vc_json';
}
}
vcFormat ??= vcFormatType.value;

if (vcFormat == null && vpFormat == null) {
if (vpFormat == null) {
throw ResponseMessage(
data: {
'error': 'invalid_request',
Expand Down

0 comments on commit b32c634

Please sign in to comment.