@@ -28,7 +28,6 @@ package com.salesforce.androidsdk.auth
2828
2929import android.content.Context
3030import androidx.annotation.VisibleForTesting
31- import com.google.android.gms.tasks.Task
3231import com.google.android.play.core.integrity.IntegrityManagerFactory.createStandard
3332import com.google.android.play.core.integrity.IntegrityServiceException
3433import com.google.android.play.core.integrity.StandardIntegrityManager
@@ -51,9 +50,10 @@ import java.util.Base64
5150 * App attestation features supporting the Salesforce App Attestation External
5251 * Client App (ECA) Plugin, the Salesforce Challenge API, Google Play Integrity
5352 * API and integration of app attestation with Salesforce Authentication.
53+ * @param apiHostName The Salesforce App Attestation Challenge API host
54+ * @param deviceId The device id, usually provided by the Salesforce SDK Manager
5455 * @param googleCloudProjectId The Google Cloud Project ID used with Google Play
5556 * Integrity API
56- * @param deviceId The device id, usually provided by the Salesforce SDK Manager
5757 * @param remoteAccessConsumerKey The Salesforce Connected App (CA) or External
5858 * Client App (ECA)remote access consumer key, usually provided by the boot
5959 * config
@@ -62,6 +62,7 @@ import java.util.Base64
6262 */
6363class AppAttestationClient (
6464 context : Context ,
65+ val apiHostName : String ,
6566 val deviceId : String ,
6667 val googleCloudProjectId : Long ,
6768 val remoteAccessConsumerKey : String ,
@@ -87,26 +88,25 @@ class AppAttestationClient(
8788 }
8889
8990 /* *
90- * (Re-)prepares the Google Play Integrity token provider.
91+ * (Re-)prepares the Google Play Integrity token provider. Calling this
92+ * prior to requesting the Integrity Token via
93+ * [createSalesforceOAuthAuthorizationAppAttestation] reduces the latency of
94+ * the request.
9195 * @param integrityManager The Google Play Integrity API integrity manager.
9296 * This parameter is intended for testing purposes only
9397 */
9498 @VisibleForTesting
9599 internal fun prepareIntegrityTokenProvider (
96100 integrityManager : StandardIntegrityManager = this.integrityManager
97- ): Task <StandardIntegrityTokenProvider > {
98-
99- // Prepare the Google Play Integrity token. Calling this prior to requesting the Integrity Token reduces the latency of the request.
100- return integrityManager.prepareIntegrityToken(
101- PrepareIntegrityTokenRequest .builder()
102- .setCloudProjectNumber(googleCloudProjectId)
103- .build()
104- ).addOnSuccessListener(
105- ::onPrepareIntegrityTokenProviderSuccess
106- ).addOnFailureListener(
107- ::onPrepareIntegrityTokenProviderFailure
108- )
109- }
101+ ) = integrityManager.prepareIntegrityToken(
102+ PrepareIntegrityTokenRequest .builder()
103+ .setCloudProjectNumber(googleCloudProjectId)
104+ .build()
105+ ).addOnSuccessListener(
106+ ::onPrepareIntegrityTokenProviderSuccess
107+ ).addOnFailureListener(
108+ ::onPrepareIntegrityTokenProviderFailure
109+ )
110110
111111 /* *
112112 * A success callback used by [prepareIntegrityTokenProvider].
@@ -202,7 +202,7 @@ class AppAttestationClient(
202202 internal fun fetchSalesforceMobileAppAttestationChallenge (): String {
203203 // Create the Salesforce App Attestation Challenge API client and fetch a new challenge.
204204 val appAttestationChallengeApiClient = AppAttestationChallengeApiClient (
205- apiHostName = " msdkappattestationtestorg.test1.my.pc-rnd.salesforce.com " , // TODO: Replace with template placeholder. ECJ20260311
205+ apiHostName = apiHostName,
206206 restClient = restClient
207207 )
208208 val salesforceAppAttestationChallenge = appAttestationChallengeApiClient.fetchChallenge(
0 commit comments