Skip to content

Commit

Permalink
Add some tests in oidc4vc
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed May 2, 2024
1 parent 7083d53 commit 0a36aed
Show file tree
Hide file tree
Showing 10 changed files with 343 additions and 269 deletions.
3 changes: 3 additions & 0 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ Future<
final OpenIdConfiguration openIdConfiguration = await oidc4vc.getOpenIdConfig(
baseUrl: issuer,
isAuthorizationServer: false,
dio: client.dio,
);

if (preAuthorizedCode == null) {
Expand All @@ -752,6 +753,7 @@ Future<
authorizationServerConfiguration = await oidc4vc.getOpenIdConfig(
baseUrl: authorizationServer,
isAuthorizationServer: true,
dio: client.dio,
);
}

Expand Down Expand Up @@ -1002,6 +1004,7 @@ Future<bool?> isEBSIV3ForVerifiers({
await oidc4vc.getOpenIdConfig(
baseUrl: clientId,
isAuthorizationServer: false,
dio: Dio(),
);

final subjectTrustFrameworksSupported =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';

import 'package:credential_manifest/credential_manifest.dart';
import 'package:dio/dio.dart';
import 'package:json_path/json_path.dart';
import 'package:oidc4vc/oidc4vc.dart';

Expand All @@ -11,6 +12,7 @@ Future<CredentialManifest> getCredentialManifestFromAltMe({
final OpenIdConfiguration openIdConfiguration = await oidc4vc.getOpenIdConfig(
baseUrl: 'https://issuer.talao.co',
isAuthorizationServer: false,
dio: Dio(),
);
final JsonPath credentialManifetPath = JsonPath(r'$..credential_manifest');
final credentialManifest = CredentialManifest.fromJson(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
stateValue: stateValue,
clientType: customOidc4vcProfile.clientType,
proofHeaderType: customOidc4vcProfile.proofHeader,
dio: client.dio,
);

String? url;
Expand Down Expand Up @@ -1293,6 +1294,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
final openIdConfiguration = await oidc4vc.getOpenIdConfig(
baseUrl: issuer,
isAuthorizationServer: false,
dio: client.dio,
);

if (savedAccessToken == null) {
Expand All @@ -1315,6 +1317,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
redirectUri: Parameters.oidc4vcUniversalLink,
openIdConfiguration: openIdConfiguration,
clientAssertion: clientAssertion,
dio: client.dio,
);

savedAccessToken = accessToken;
Expand Down
2 changes: 2 additions & 0 deletions lib/oidc4vc/get_and_add_deffered_credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:altme/credentials/credentials.dart';
import 'package:altme/dashboard/dashboard.dart';

import 'package:altme/oidc4vc/oidc4vc.dart';
import 'package:dio/dio.dart';
import 'package:jwt_decode/jwt_decode.dart';
import 'package:oidc4vc/oidc4vc.dart';

Expand Down Expand Up @@ -53,6 +54,7 @@ Future<void> getAndAddDefferedCredential({
deferredCredentialEndpoint:
credentialModel.pendingInfo!.deferredCredentialEndpoint,
body: body,
dio: Dio(),
);

await addOIDC4VCCredential(
Expand Down
1 change: 1 addition & 0 deletions lib/oidc4vc/get_authorization_uri_for_issuer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Future<void> getAuthorizationUriForIssuer({
vcFormatType: vcFormatType,
clientAssertion: clientAssertion,
secureAuthorizedFlow: secureAuthorizedFlow,
dio: client.dio,
);

if (secureAuthorizedFlow) {
Expand Down
2 changes: 2 additions & 0 deletions lib/oidc4vc/get_credential.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:dio/dio.dart';
import 'package:oidc4vc/oidc4vc.dart';

/// Retreive credential_type from url
Expand Down Expand Up @@ -61,6 +62,7 @@ Future<
cnonce: nonce,
authorizationDetails: authorizationDetails,
openIdConfiguration: openIdConfiguration,
dio: Dio(),
);

return (
Expand Down
2 changes: 2 additions & 0 deletions lib/oidc4vc/verify_encoded_data.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:altme/app/app.dart';
import 'package:dio/dio.dart';
import 'package:jwt_decode/jwt_decode.dart';
import 'package:oidc4vc/oidc4vc.dart';

Expand Down Expand Up @@ -34,6 +35,7 @@ Future<VerificationType> verifyEncodedData({
publicJwk: publicKeyJwk,
fromStatusList: fromStatusList,
isCachingEnabled: isCachingEnabled,
dio: Dio(),
);
return verificationType;
}
1 change: 1 addition & 0 deletions lib/splash/bloclisteners/blocklisteners.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ final qrCodeBlocListener = BlocListener<QRCodeScanCubit, QRCodeScanState>(
openIdConfiguration: openIdConfiguration,
issuer: issuer,
oidc4vciDraftType: customOidc4vcProfile.oidc4vciDraft,
dio: Dio(),
);

credentialEndpoint =
Expand Down
Loading

0 comments on commit 0a36aed

Please sign in to comment.