Parse custom_recovery_passphrase_settings from Element .well-known

Add CustomRecoveryPassphraseRequirements to ElementWellKnown and decode
the custom_recovery_passphrase_settings block (currently just
min_character_count) from the homeserver's element.json. Invalid specs
(missing or non-positive min_character_count) are logged and mapped to
null so the setup flow falls back to the generated-key path. Field names
match the ESS well-known schema (element-enterprise#261).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jenna Vassar
2026-06-02 13:33:18 -07:00
parent 748454f34d
commit 2931418018
7 changed files with 181 additions and 1 deletions
@@ -8,6 +8,7 @@
package io.element.android.features.wellknown.test
import io.element.android.libraries.wellknown.api.CustomRecoveryPassphraseRequirements
import io.element.android.libraries.wellknown.api.ElementWellKnown
fun anElementWellKnown(
@@ -17,6 +18,7 @@ fun anElementWellKnown(
brandColor: String? = null,
notificationSound: String? = null,
identityProviderAppScheme: String? = null,
customRecoveryPassphraseRequirements: CustomRecoveryPassphraseRequirements? = null,
) = ElementWellKnown(
registrationHelperUrl = registrationHelperUrl,
enforceElementPro = enforceElementPro,
@@ -24,4 +26,11 @@ fun anElementWellKnown(
brandColor = brandColor,
notificationSound = notificationSound,
identityProviderAppScheme = identityProviderAppScheme,
customRecoveryPassphraseRequirements = customRecoveryPassphraseRequirements,
)
fun aCustomRecoveryPassphraseRequirements(
minCharacterCount: Int = 8,
) = CustomRecoveryPassphraseRequirements(
minCharacterCount = minCharacterCount,
)