Skip to content

Commit

Permalink
chore(app): ci fix
Browse files Browse the repository at this point in the history
Signed-off-by: Talwinder Kaur <[email protected]>
  • Loading branch information
talwinder50 committed Feb 4, 2025
1 parent 8357843 commit 8452519
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 290 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
119 changes: 0 additions & 119 deletions demo/app/android/app/src/androidTest/kotlin/integration_test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,123 +170,4 @@ class IntegrationTest {
"registration", """{"email":"[email protected]"}""").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)
}
}
}
}
65 changes: 1 addition & 64 deletions demo/app/integration_test/openid4ci_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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<String, dynamic> 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)));
});
}
161 changes: 161 additions & 0 deletions demo/app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 8452519

Please sign in to comment.