From 5313a9aaded39c6ebb5cce2189af94ec71254884 Mon Sep 17 00:00:00 2001 From: Talwinder Kaur Date: Wed, 29 Jan 2025 22:55:40 -0500 Subject: [PATCH] chore(app): ci fix Signed-off-by: Talwinder Kaur --- .github/workflows/build.yml | 10 +- cmd/wallet-sdk-gomobile/go.sum | 4 +- .../androidTest/kotlin/integration_test.kt | 119 ------------- demo/app/integration_test/openid4ci_test.dart | 65 +------ demo/app/ios/Podfile.lock | 161 ++++++++++++++++++ .../ios/Runner/Tests/IntegrationTest.swift | 100 ----------- scripts/flutter_test.sh | 2 +- scripts/ios_test.sh | 4 +- 8 files changed, 172 insertions(+), 293 deletions(-) create mode 100644 demo/app/ios/Podfile.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 246d1b7ab..2692ed1af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -211,11 +211,11 @@ jobs: echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts - name: Install and start docker - uses: douglascamata/setup-docker-macos-action@8d5fa43892aed7eee4effcdea113fd53e4d4bf83 + uses: douglascamata/setup-docker-macos-action@v1-alpha with: upgrade-qemu: false - lima: v0.22.0 - colima: v0.7.3 + lima: v1.0.4 + colima: v0.8.1 - name: Download artifacts (Docker images) from previous workflows uses: actions/download-artifact@v4 - name: Load mock-login-consent server @@ -246,7 +246,7 @@ jobs: - name: Run iOS Simulator uses: futureware-tech/simulator-action@v3 with: - model: 'iPhone 14' + model: 'iPhone 15' - name: Remove AppIcon contents file (Simulator build fails with this file) run: | rm -rf demo/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -292,7 +292,7 @@ jobs: echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts - name: Install and start docker - uses: douglascamata/setup-docker-macos-action@8d5fa43892aed7eee4effcdea113fd53e4d4bf83 + uses: douglascamata/setup-docker-macos-action@v1-alpha with: upgrade-qemu: false lima: v0.22.0 diff --git a/cmd/wallet-sdk-gomobile/go.sum b/cmd/wallet-sdk-gomobile/go.sum index e96a6e11d..3eb89152b 100644 --- a/cmd/wallet-sdk-gomobile/go.sum +++ b/cmd/wallet-sdk-gomobile/go.sum @@ -209,8 +209,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= diff --git a/demo/app/android/app/src/androidTest/kotlin/integration_test.kt b/demo/app/android/app/src/androidTest/kotlin/integration_test.kt index c38fcfd0d..d51f3a522 100644 --- a/demo/app/android/app/src/androidTest/kotlin/integration_test.kt +++ b/demo/app/android/app/src/androidTest/kotlin/integration_test.kt @@ -170,123 +170,4 @@ class IntegrationTest { "registration", """{"email":"test@example.com"}""").addScopeClaim("testscope", """{"data": "testdata"}""") .setAttestationVC(userDID.assertionMethod(), attestationVC.serialize())) } - - @Test - fun testAuthFlow() { - val trace = Otel.newTrace() - - assertThat(Version.getVersion()).isEqualTo("testVer") - assertThat(Version.getGitRevision()).isEqualTo("testRev") - assertThat(Version.getBuildTime()).isEqualTo("testTime") - - val kms = Localkms.newKMS(KmsStore(instrumentationContext)) - - val resolverOpts = ResolverOpts() - resolverOpts.setResolverServerURI("http://localhost:8072/1.0/identifiers") - val didResolver = Resolver(resolverOpts) - - val crypto = kms.crypto - - val jwk = kms.create(Localkms.KeyTypeED25519) - - val userDID = Didion.createLongForm(jwk) - - // Issue VCs - val requestURI = BuildConfig.INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW - println("requestURI ->") - println(requestURI) - - val requiredOpenID4CIArgs = IssuerInitiatedInteractionArgs(requestURI, crypto, didResolver) - println("requiredOpenID4CIArgs") - println(requiredOpenID4CIArgs) - val ciOpts = InteractionOpts() - ciOpts.addHeader(trace.traceHeader()) - - val ciInteraction = IssuerInitiatedInteraction(requiredOpenID4CIArgs, ciOpts) - var clientID = "oidc4vc_client" - val redirectURI = "http://127.0.0.1/callback" - var scopes = StringArray() - scopes.append("openid").append("profile") - - assertThat(ciInteraction.dynamicClientRegistrationSupported()).isTrue() - - if (ciInteraction.dynamicClientRegistrationSupported()) { - var dynamicRegistrationEndpoint = ciInteraction.dynamicClientRegistrationEndpoint() - assertThat(dynamicRegistrationEndpoint).isNotEmpty() - - var clientMetadata = Oauth2.newClientMetadata() - var grantTypesArr = StringArray() - grantTypesArr.append("authorization_code") - clientMetadata.setGrantTypes(grantTypesArr) - assertThat(clientMetadata.grantTypes()).isNotNull() - - var redirectUri = StringArray() - redirectUri.append(redirectURI) - clientMetadata.setRedirectURIs(redirectUri) - assertThat(clientMetadata.redirectURIs()).isNotNull() - - clientMetadata.setScopes(scopes) - clientMetadata.setTokenEndpointAuthMethod("none") - - var authorizationCodeGrantParams = ciInteraction.authorizationCodeGrantParams() - if (authorizationCodeGrantParams.hasIssuerState()) { - var issuerState = authorizationCodeGrantParams.issuerState() - clientMetadata.setIssuerState(issuerState) - assertThat(clientMetadata.issuerState()).isNotEmpty() - } - - var registrationResp = Oauth2.registerClient(dynamicRegistrationEndpoint, clientMetadata, null) - clientID = registrationResp.clientID() - assertThat(clientID).isNotEmpty() - - scopes = registrationResp.registeredMetadata().scopes() - assertThat(scopes).isNotNull() - } - - val authCodeGrant = ciInteraction.authorizationCodeGrantTypeSupported() - assertThat(authCodeGrant).isTrue() - - val createAuthorizationURLOpts = CreateAuthorizationURLOpts().setScopes(scopes) - - val authorizationLink = ciInteraction.createAuthorizationURL(clientID, redirectURI, createAuthorizationURLOpts) - assertThat(authorizationLink).isNotEmpty() - - var redirectUrl = URI(authorizationLink) - - val client = OkHttpClient.Builder() - .retryOnConnectionFailure(true) - .followRedirects(false) - .build() - - var request = Request.Builder() - .url(redirectUrl.toString()) - .header("Connection", "close") - .build() - val response = client.newCall(request).execute() - assertThat(response.isRedirect).isTrue() - var location = response.headers["Location"] - assertThat(location).contains("cognito-mock.trustbloc.local") - if (location != null) { - if (location.contains("cognito-mock.trustbloc.local")) { - var upr = URI(location.replace("cognito-mock.trustbloc.local", "localhost")); - assertThat(upr.toString()).contains("localhost") - var request = Request.Builder() - .url(upr.toString()) - .header("Connection", "close") - .build() - val response = client.newCall(request).clone().execute() - location = response.headers["location"] - assertThat(location).contains("oidc/redirect") - var request2 = Request.Builder() - .url(location.toString()) - .header("Connection", "close") - .build() - val response2 = client.newCall(request2).clone().execute() - location = response2.headers["location"] - assertThat(location).contains("127.0.0.1") - var issuedCreds = ciInteraction.requestCredentialWithAuth(userDID.assertionMethod(), location, null) - assertThat(issuedCreds.length()).isGreaterThan(0) - } - } - } } diff --git a/demo/app/integration_test/openid4ci_test.dart b/demo/app/integration_test/openid4ci_test.dart index f899409da..3b07dd2ae 100644 --- a/demo/app/integration_test/openid4ci_test.dart +++ b/demo/app/integration_test/openid4ci_test.dart @@ -84,7 +84,7 @@ void main() async { await walletSDKPlugin.presentCredential( selectedCredentials: credentials, customScopeList: customScopesList, attestationVC: attestationVC); } - }); + }, timeout: Timeout(Duration(minutes: 10))); testWidgets('Testing openid4vc with multiple credentials', (tester) async { const didMethodTypes = String.fromEnvironment('WALLET_DID_METHODS'); @@ -142,67 +142,4 @@ void main() async { await walletSDKPlugin.presentCredential(selectedCredentials: matchedCreds, customScopeList: customScopesList); }); - - testWidgets('Testing openid4vc with the auth code flow', (tester) async { - const didMethodTypes = String.fromEnvironment('WALLET_DID_METHODS'); - var didMethodTypesList = didMethodTypes.split(' '); - String didMethodType = didMethodTypesList[0]; - print('wallet DID type : $didMethodType'); - print('wallet DID Key type : $didKeyType'); - var didDocData = await walletSDKPlugin.createDID(didMethodTypesList[0], didKeyType); - print('wallet didDocData : $didDocData'); - var didContent = didDocData.did; - print('wallet DID : $didContent'); - - const issuanceURL = String.fromEnvironment('INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW'); - debugPrint('issuanceURLs Auth Code Flow: $issuanceURL'); - - var authCodeArgs = { - 'scopes': ['openid', 'profile'], - 'clientID': 'oidc4vc_client', - 'redirectURI': 'http://127.0.0.1/callback' - }; - - var initializeResp = await walletSDKPlugin.initialize(issuanceURL, authCodeArgs); - var initializeRespEncoded = json.encode(initializeResp!); - Map initializeRespJson = json.decode(initializeRespEncoded); - var authorizationURLLink = initializeRespJson['authorizationURLLink']; - debugPrint('authorizationURLLink: $authorizationURLLink'); - // fetching redirect uri - String redirectURI = ''; - final client = HttpClient(); - var redirectUrl = Uri.parse(authorizationURLLink); - var request = await client.getUrl(redirectUrl); - request.followRedirects = false; - var response = await request.close(); - while (response.isRedirect) { - response.drain(); - final location = response.headers.value(HttpHeaders.locationHeader); - if (location != null) { - redirectUrl = redirectUrl.resolve(location); - if (location.contains('http://127.0.0.1/callback')) { - redirectURI = location; - break; - } - if (redirectUrl.host.contains('cognito-mock.trustbloc.local')) { - redirectUrl = Uri.parse(redirectUrl.toString().replaceAll('cognito-mock.trustbloc.local', 'localhost')); - print('uri updated $redirectUrl'); - } - request = await client.getUrl(redirectUrl); - request.followRedirects = false; - response = await request.close(); - } - } - - debugPrint('redirectURI $redirectURI'); - - final credential = await walletSDKPlugin.requestCredentialWithAuth(redirectURI); - debugPrint('content: $credential'); - for (final p in credential.split('.')) { - print('----'); - print(p); - } - - expect(credential, hasLength(greaterThan(0))); - }); } diff --git a/demo/app/ios/Podfile.lock b/demo/app/ios/Podfile.lock new file mode 100644 index 000000000..57da38dff --- /dev/null +++ b/demo/app/ios/Podfile.lock @@ -0,0 +1,161 @@ +PODS: + - DTTJailbreakDetection (0.4.0) + - Flutter (1.0.0) + - flutter_secure_storage (6.0.0): + - Flutter + - GoogleDataTransport (9.4.1): + - GoogleUtilities/Environment (~> 7.7) + - nanopb (< 2.30911.0, >= 2.30908.0) + - PromisesObjC (< 3.0, >= 1.2) + - GoogleMLKit/BarcodeScanning (6.0.0): + - GoogleMLKit/MLKitCore + - MLKitBarcodeScanning (~> 5.0.0) + - GoogleMLKit/MLKitCore (6.0.0): + - MLKitCommon (~> 11.0.0) + - GoogleToolboxForMac/Defines (4.2.1) + - GoogleToolboxForMac/Logger (4.2.1): + - GoogleToolboxForMac/Defines (= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (4.2.1)": + - GoogleToolboxForMac/Defines (= 4.2.1) + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.13.3): + - GoogleUtilities/Environment + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/UserDefaults (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilitiesComponents (1.1.0): + - GoogleUtilities/Logger + - GTMSessionFetcher/Core (3.5.0) + - integration_test (0.0.1): + - Flutter + - MLImage (1.0.0-beta5) + - MLKitBarcodeScanning (5.0.0): + - MLKitCommon (~> 11.0) + - MLKitVision (~> 7.0) + - MLKitCommon (11.0.0): + - GoogleDataTransport (< 10.0, >= 9.4.1) + - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" + - GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0) + - GoogleUtilitiesComponents (~> 1.0) + - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) + - MLKitVision (7.0.0): + - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" + - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) + - MLImage (= 1.0.0-beta5) + - MLKitCommon (~> 11.0) + - mobile_scanner (5.1.1): + - Flutter + - GoogleMLKit/BarcodeScanning (~> 6.0.0) + - nanopb (2.30910.0): + - nanopb/decode (= 2.30910.0) + - nanopb/encode (= 2.30910.0) + - nanopb/decode (2.30910.0) + - nanopb/encode (2.30910.0) + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - permission_handler_apple (9.3.0): + - Flutter + - PromisesObjC (2.4.0) + - safe_device (1.0.0): + - DTTJailbreakDetection + - Flutter + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS + - uni_links (0.0.1): + - Flutter + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - integration_test (from `.symlinks/plugins/integration_test/ios`) + - mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - safe_device (from `.symlinks/plugins/safe_device/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - uni_links (from `.symlinks/plugins/uni_links/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +SPEC REPOS: + trunk: + - DTTJailbreakDetection + - GoogleDataTransport + - GoogleMLKit + - GoogleToolboxForMac + - GoogleUtilities + - GoogleUtilitiesComponents + - GTMSessionFetcher + - MLImage + - MLKitBarcodeScanning + - MLKitCommon + - MLKitVision + - nanopb + - PromisesObjC + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_secure_storage: + :path: ".symlinks/plugins/flutter_secure_storage/ios" + integration_test: + :path: ".symlinks/plugins/integration_test/ios" + mobile_scanner: + :path: ".symlinks/plugins/mobile_scanner/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" + safe_device: + :path: ".symlinks/plugins/safe_device/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" + uni_links: + :path: ".symlinks/plugins/uni_links/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + DTTJailbreakDetection: 5e356c5badc17995f65a83ed9483f787a0057b71 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 + GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a + GoogleMLKit: 97ac7af399057e99182ee8edfa8249e3226a4065 + GoogleToolboxForMac: d1a2cbf009c453f4d6ded37c105e2f67a32206d8 + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 + GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe + GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 + integration_test: 13825b8a9334a850581300559b8839134b124670 + MLImage: 1824212150da33ef225fbd3dc49f184cf611046c + MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b + MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1 + MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1 + mobile_scanner: 8564358885a9253c43f822435b70f9345c87224f + nanopb: 438bc412db1928dac798aa6fd75726007be04262 + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + safe_device: 4539eb6bdbeb4b61a763a51c4e73e6b37dea4e3d + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + uni_links: d97da20c7701486ba192624d99bffaaffcfc298a + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + +PODFILE CHECKSUM: 3320f6149474f3df566b99ab7a7d7d9e043aec65 + +COCOAPODS: 1.15.2 diff --git a/demo/app/ios/Runner/Tests/IntegrationTest.swift b/demo/app/ios/Runner/Tests/IntegrationTest.swift index d1da977d9..94b6bfb74 100644 --- a/demo/app/ios/Runner/Tests/IntegrationTest.swift +++ b/demo/app/ios/Runner/Tests/IntegrationTest.swift @@ -146,106 +146,6 @@ class IntegrationTest: XCTestCase { opts: Openid4vpNewPresentCredentialOpts()!.addScopeClaim("registration", claimJSON:#"{"email":"test@example.com"}"#)!.addScopeClaim("testscope", claimJSON: #"{"data": "testdata"}"#)!.setAttestationVC(userDID!.assertionMethod(), vc: try attestationVC.serialize(nil)) ) } - - func testAuthFlow() throws { - let trace = OtelNewTrace(nil) - let kms = LocalkmsNewKMS(kmsStore(), nil)! - - let resolverOpts = DidNewResolverOpts() - resolverOpts!.setResolverServerURI("http://localhost:8072/1.0/identifiers") - let didResolver = DidNewResolver(resolverOpts, nil)! - - let crypto = kms.getCrypto() - - let jwk = try kms.create(LocalkmsKeyTypeED25519) - - var error: NSError? - - let userDID = DidionCreateLongForm(jwk, &error) - XCTAssertNil(error) - - // Issue VCs in auth flow - let requestAuthURI = ProcessInfo.processInfo.environment["INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW"] - print(requestAuthURI) - XCTAssertTrue(requestAuthURI != "", "requestAuthURI:" + requestAuthURI!) - - let openID4CIInteractionArgs = Openid4ciNewIssuerInitiatedInteractionArgs(requestAuthURI, crypto, didResolver) - - let ciOpts = Openid4ciNewInteractionOpts() - ciOpts!.add(trace!.traceHeader()) - - let ciInteraction = Openid4ciNewIssuerInitiatedInteraction(openID4CIInteractionArgs, ciOpts, nil) - XCTAssertNotNil(ciInteraction) - let redirectURI = "http://127.0.0.1/callback" - var clientID = "oidc4vc_client" - var scopes = ApiNewStringArray()! - var scopesFromArgs = ["openid", "profile"] as! [String] - - for scope in scopesFromArgs { - scopes.append(scope) - } - - if (ciInteraction?.dynamicClientRegistrationSupported != nil) { - let dynamicRegistrationEndpoint = ciInteraction?.dynamicClientRegistrationEndpoint(nil) - XCTAssertNotNil(dynamicRegistrationEndpoint) - - let clientMetadata = Oauth2ClientMetadata() - let grantTypesArr = ApiStringArray() - grantTypesArr?.append("authorization_code") - clientMetadata?.setGrantTypes(grantTypesArr) - XCTAssertNotNil(grantTypesArr) - - let redirectURIArr = ApiStringArray() - redirectURIArr?.append(redirectURI) - clientMetadata?.setRedirectURIs(redirectURIArr) - XCTAssertNotNil(redirectURIArr) - - clientMetadata?.setScopes(scopes) - clientMetadata?.setTokenEndpointAuthMethod("none") - - let authorizationCodeGrantParams = try ciInteraction?.authorizationCodeGrantParams() - - if ((authorizationCodeGrantParams?.hasIssuerState()) != nil) { - let issuerState = authorizationCodeGrantParams!.issuerState(nil) - clientMetadata?.setIssuerState(issuerState) - XCTAssertNotNil(clientMetadata?.issuerState()) - } - - let registrationResp = Oauth2RegisterClient(dynamicRegistrationEndpoint, clientMetadata, nil, nil) - clientID = (registrationResp?.clientID())! - scopes = (registrationResp!.registeredMetadata())!.scopes()! - } - - let authCodeGrant = ciInteraction!.authorizationCodeGrantTypeSupported() - XCTAssertTrue(authCodeGrant) - - let opts = Openid4ciNewCreateAuthorizationURLOpts()!.setScopes(scopes) - let authorizationLink = ciInteraction!.createAuthorizationURL(clientID, redirectURI: redirectURI, opts: opts!, error: nil) - XCTAssertTrue(authorizationLink != "", "authorizationLink:" + authorizationLink) - - var redirectURL = "" - let r = Redirect() - let url = URL(string: authorizationLink)! - r.makeRequest(url: url, callback: { (location) in - guard let locationURL = location else {return} - var updatedLoc = locationURL.absoluteString - redirectURL = updatedLoc.replacingOccurrences(of: "cognito-mock.trustbloc.local",with: "localhost") - r.makeRequest(url: URL(string: redirectURL)!, callback: { (location) in - guard let locationURL = location else {return} - r.makeRequest(url: locationURL, callback: { (location) in - guard let locationURL = location else {return} - redirectURL = locationURL.absoluteString - do { - let issuedCreds = try ciInteraction!.requestCredential(withAuth:userDID!.assertionMethod(), redirectURIWithAuthCode: redirectURL, opts: nil) - XCTAssertTrue(issuedCreds.length() > 0) - } catch { - print("Error: \(error)") - } - return - }) - }) - }) - } } diff --git a/scripts/flutter_test.sh b/scripts/flutter_test.sh index 811ecffde..88e49d97c 100755 --- a/scripts/flutter_test.sh +++ b/scripts/flutter_test.sh @@ -23,4 +23,4 @@ INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW=$(../../build/bin/integration-cli auth-cod echo "INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW:${INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW}" cd ../../demo/app -flutter test integration_test "$@" --dart-define=INITIATE_ISSUANCE_URLS="${INITIATE_ISSUANCE_URLS}" --dart-define=WALLET_DID_METHODS="ion key jwk ion" --dart-define=DID_RESOLVER_URI="http://localhost:8072/1.0/identifiers" --dart-define=INITIATE_VERIFICATION_URLS="${INITIATE_VERIFICATION_URLS}" --dart-define=INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS="${INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS}" --dart-define=INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS="${INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS}" --dart-define=INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW="${INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW}" \ No newline at end of file +flutter test integration_test"$@" --dart-define=INITIATE_ISSUANCE_URLS="${INITIATE_ISSUANCE_URLS}" --dart-define=WALLET_DID_METHODS="ion key jwk ion" --dart-define=DID_RESOLVER_URI="http://localhost:8072/1.0/identifiers" --dart-define=INITIATE_VERIFICATION_URLS="${INITIATE_VERIFICATION_URLS}" --dart-define=INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS="${INITIATE_ISSUANCE_URLS_MULTIPLE_CREDS}" --dart-define=INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS="${INITIATE_VERIFICATION_URLS_MULTIPLE_CREDS}" --dart-define=INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW="${INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW}" \ No newline at end of file diff --git a/scripts/ios_test.sh b/scripts/ios_test.sh index 2b9f45739..9b3fb2fb3 100755 --- a/scripts/ios_test.sh +++ b/scripts/ios_test.sh @@ -16,6 +16,6 @@ echo "INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW:${INITIATE_ISSUANCE_URLS_AUTH_CODE_F cd ../../demo/app -flutter build ios --simulator +flutter build ios --simulator -v cd ios -INITIATE_ISSUANCE_URL="${INITIATE_ISSUANCE_URL}" INITIATE_VERIFICATION_URL="${INITIATE_VERIFICATION_URL}" INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW="${INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW}" xcodebuild test -workspace Runner.xcworkspace -scheme Runner -destination 'platform=iOS Simulator,name=iPhone 14,OS=17.0.1' +INITIATE_ISSUANCE_URL="${INITIATE_ISSUANCE_URL}" INITIATE_VERIFICATION_URL="${INITIATE_VERIFICATION_URL}" INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW="${INITIATE_ISSUANCE_URLS_AUTH_CODE_FLOW}" xcodebuild test -workspace Runner.xcworkspace -scheme Runner -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.0.1'