Skip to content

Commit 56f29c6

Browse files
committed
chore: Make AppIntegrityManager implement AbstractAppIntegrityManager
1 parent 8ceb6bc commit 56f29c6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

AppIntegrity/src/standard/kotlin/com/infomaniak/core/appintegrity/AppIntegrityManager.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Core - Android
3-
* Copyright (C) 2024 Infomaniak Network SA
3+
* Copyright (C) 2024-2025 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ import java.util.UUID
4242
* - the standard request ([requestIntegrityVerdictToken]) that need a warm-up first ([warmUpTokenProvider])
4343
* - the classic request ([requestClassicIntegrityVerdictToken]) that need additional API checks
4444
*/
45-
class AppIntegrityManager(private val appContext: Context, userAgent: String) {
45+
class AppIntegrityManager(private val appContext: Context, userAgent: String) : AbstractAppIntegrityManager() {
4646

4747
private var appIntegrityTokenProvider: StandardIntegrityTokenProvider? = null
4848
private val classicIntegrityTokenProvider by lazy { IntegrityManagerFactory.create(appContext) }
@@ -54,7 +54,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
5454
* This function is needed in case of standard verdict request by [requestIntegrityVerdictToken].
5555
* It must be called once at the initialisation because it can take a long time (up to several minutes)
5656
*/
57-
fun warmUpTokenProvider(appCloudNumber: Long, onFailure: () -> Unit) {
57+
override fun warmUpTokenProvider(appCloudNumber: Long, onFailure: () -> Unit) {
5858
val integrityManager = IntegrityManagerFactory.createStandard(appContext)
5959
integrityManager.prepareIntegrityToken(
6060
PrepareIntegrityTokenRequest.builder().setCloudProjectNumber(appCloudNumber).build()
@@ -68,7 +68,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
6868
* Standard verdict request for Integrity token
6969
* It should protect automatically from replay attack, but for now this protection seemed to not be working
7070
*/
71-
fun requestIntegrityVerdictToken(
71+
override fun requestIntegrityVerdictToken(
7272
requestHash: String,
7373
onSuccess: (String) -> Unit,
7474
onFailure: () -> Unit,
@@ -91,7 +91,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
9191
*
9292
* ###### Can throw Integrity exceptions.
9393
*/
94-
suspend fun requestClassicIntegrityVerdictToken(challenge: String): String {
94+
override suspend fun requestClassicIntegrityVerdictToken(challenge: String): String {
9595
val nonce = Base64.encodeToString(challenge.toByteArray(), Base64.DEFAULT)
9696
val token: CompletableDeferred<String> = CompletableDeferred()
9797

@@ -115,7 +115,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
115115
}
116116
}
117117

118-
suspend fun getChallenge(): String {
118+
override suspend fun getChallenge(): String {
119119
generateChallengeId()
120120
val apiResponse = appIntegrityRepository.getChallenge(challengeId)
121121
SentryLog.d(
@@ -125,7 +125,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
125125
return apiResponse.data ?: error("Get challenge cannot contain null data")
126126
}
127127

128-
suspend fun getApiIntegrityVerdict(
128+
override suspend fun getApiIntegrityVerdict(
129129
integrityToken: String,
130130
packageName: String,
131131
targetUrl: String,
@@ -150,7 +150,7 @@ class AppIntegrityManager(private val appContext: Context, userAgent: String) {
150150
/**
151151
* Only used to test App Integrity in Apps before their real backend implementation
152152
*/
153-
suspend fun callDemoRoute(mobileToken: String) {
153+
override suspend fun callDemoRoute(mobileToken: String) {
154154
runCatching {
155155
val apiResponse = appIntegrityRepository.demo(mobileToken)
156156
val logMessage = if (apiResponse.isSuccess()) {

0 commit comments

Comments
 (0)