Remove custom recovery passphrase API from EnterpriseService

These methods gated the feature at runtime. The gate is now a DI binding swap in the enterprise build (EnterpriseSecureBackupSetupEntryPoint replaces the FOSS default), so the EnterpriseService surface and the CustomRecoveryPassphraseStrength result types are no longer needed in FOSS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jenna Vassar
2026-06-08 15:36:16 -07:00
parent a050716123
commit 6710b1c9c1
4 changed files with 0 additions and 64 deletions
@@ -1,35 +0,0 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.features.enterprise.api
/**
* Strength tier surfaced to the user under a custom recovery passphrase field.
* The eight tiers mirror iOS `PasswordStrengthThreshold` 1:1 so both clients label a given
* passphrase identically; each maps to its own label and time-to-crack description in the UI.
*/
enum class CustomRecoveryPassphraseStrength {
Garbage,
Weak,
Moderate,
Okay,
Strong,
VeryStrong,
UltraStrong,
Mega,
}
/**
* Result of estimating a custom recovery passphrase's strength. The estimation algorithm itself
* is an enterprise capability ([EnterpriseService.estimateCustomRecoveryPassphraseStrength]); FOSS
* builds never produce one.
*/
data class CustomRecoveryPassphraseStrengthResult(
val strength: CustomRecoveryPassphraseStrength,
/** Fill amount for the progress bar. Always in `0f..1f`. */
val score: Float,
)
@@ -41,22 +41,6 @@ interface EnterpriseService {
*/ */
fun getNoisyNotificationChannelId(sessionId: SessionId): String? fun getNoisyNotificationChannelId(sessionId: SessionId): String?
/**
* Whether the user is allowed to set a custom recovery passphrase.
* Enterprise builds gate this in addition to the homeserver's .well-known `customRecoveryPassphraseRequirements`;
* when false the setup flow falls back to the auto-generated key path even if the homeserver
* advertises a spec.
*/
fun isCustomRecoveryPassphraseEnabled(): Boolean
/**
* Estimate the strength of a user-typed custom recovery [passphrase].
* The estimation algorithm is an enterprise capability: FOSS builds return null, so callers
* should treat null as "no indicator to show". Callers are responsible for not calling this with
* an empty passphrase if they want the indicator hidden while the field is empty.
*/
fun estimateCustomRecoveryPassphraseStrength(passphrase: String): CustomRecoveryPassphraseStrengthResult?
companion object { companion object {
const val ANY_ACCOUNT_PROVIDER = "*" const val ANY_ACCOUNT_PROVIDER = "*"
} }
@@ -13,7 +13,6 @@ import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.ContributesBinding import dev.zacsweers.metro.ContributesBinding
import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.compound.colors.SemanticColorsLightDark
import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.BugReportUrl
import io.element.android.features.enterprise.api.CustomRecoveryPassphraseStrengthResult
import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.SessionId
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
@@ -46,8 +45,4 @@ class DefaultEnterpriseService : EnterpriseService {
} }
override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null
override fun isCustomRecoveryPassphraseEnabled(): Boolean = false
override fun estimateCustomRecoveryPassphraseStrength(passphrase: String): CustomRecoveryPassphraseStrengthResult? = null
} }
@@ -11,7 +11,6 @@ package io.element.android.features.enterprise.test
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.compound.colors.SemanticColorsLightDark
import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.BugReportUrl
import io.element.android.features.enterprise.api.CustomRecoveryPassphraseStrengthResult
import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.tests.testutils.lambda.lambdaError import io.element.android.tests.testutils.lambda.lambdaError
@@ -32,8 +31,6 @@ class FakeEnterpriseService(
private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() }, private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() },
private val getNoisyNotificationChannelIdResult: (SessionId?) -> String? = { lambdaError() }, private val getNoisyNotificationChannelIdResult: (SessionId?) -> String? = { lambdaError() },
private val tweakMasUrlResult: (String, String) -> String = { _, _ -> lambdaError() }, private val tweakMasUrlResult: (String, String) -> String = { _, _ -> lambdaError() },
private val isCustomRecoveryPassphraseEnabledResult: Boolean = false,
private val estimateCustomRecoveryPassphraseStrengthResult: (String) -> CustomRecoveryPassphraseStrengthResult? = { null },
) : EnterpriseService { ) : EnterpriseService {
private val brandColorState = MutableStateFlow(initialBrandColor) private val brandColorState = MutableStateFlow(initialBrandColor)
private val semanticColorsState = MutableStateFlow(initialSemanticColors) private val semanticColorsState = MutableStateFlow(initialSemanticColors)
@@ -82,9 +79,4 @@ class FakeEnterpriseService(
override fun getNoisyNotificationChannelId(sessionId: SessionId): String? { override fun getNoisyNotificationChannelId(sessionId: SessionId): String? {
return getNoisyNotificationChannelIdResult(sessionId) return getNoisyNotificationChannelIdResult(sessionId)
} }
override fun isCustomRecoveryPassphraseEnabled(): Boolean = isCustomRecoveryPassphraseEnabledResult
override fun estimateCustomRecoveryPassphraseStrength(passphrase: String): CustomRecoveryPassphraseStrengthResult? =
estimateCustomRecoveryPassphraseStrengthResult(passphrase)
} }