mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
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:
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.libraries.wellknown.api
|
||||
|
||||
/**
|
||||
* Server-driven requirements for a user-chosen recovery passphrase. Today the only rule
|
||||
* is a minimum character count; additional rules can be added here as the well-known
|
||||
* schema (`custom_recovery_passphrase_settings`) grows.
|
||||
*/
|
||||
data class CustomRecoveryPassphraseRequirements(
|
||||
val minCharacterCount: Int,
|
||||
) {
|
||||
/** True when [input] meets every active rule. */
|
||||
fun isSatisfiedBy(input: String): Boolean = isSatisfiedBy(input.length)
|
||||
|
||||
/** True when an input of [length] characters meets every active rule. */
|
||||
fun isSatisfiedBy(length: Int): Boolean = length >= minCharacterCount
|
||||
}
|
||||
+1
@@ -15,4 +15,5 @@ data class ElementWellKnown(
|
||||
val brandColor: String?,
|
||||
val notificationSound: String?,
|
||||
val identityProviderAppScheme: String?,
|
||||
val customRecoveryPassphraseRequirements: CustomRecoveryPassphraseRequirements?,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user