git.iko.soy/opencode-android
on 9f0326a help sign in
27 lines 1.0 kB history raw
1package soy.iko.opencode.data.model
3import androidx.compose.runtime.Immutable
5/**
6 * A saved opencode server connection. The [password] for HTTP Basic auth is resolved
7 * separately from EncryptedSharedPreferences and is null when not loaded/needed.
8 */
9@Immutable
10data class ServerProfile(
11 val id: String,
12 val label: String,
13 val baseUrl: String,
14 val username: String? = null,
15 val password: String? = null,
16 val lastUsed: Long = 0,
17 // When true, the client upgrades a cleartext http:// URL to https:// so credentials and
18 // traffic are never sent over the wire in the clear for this server.
19 val requireHttps: Boolean = false,
20 // Optional OkHttp certificate pin(s) ("sha256/<base64>", whitespace/comma-separated for
21 // multiple) applied to this server's TLS connection for defense against a rogue CA.
22 val certPin: String? = null,
23) {
24 val hasAuth: Boolean get() = !username.isNullOrBlank()
26 val displayLabel: String get() = label.takeIf { it.isNotBlank() } ?: baseUrl