feat: center square Hope presence and guide secure certificate setup

This commit is contained in:
snowspeeder committed 2026-10-01 18:02:14 -04:00
1 parent 6f2659421c
commit 15c6389ffb
12 files changed
+252 -129

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import Foundation
import Testing
@testable import Voice
/// Explicit opt-in native CFNetwork probe; no account credentials or bodies.
struct TLSLiveTests {
@Test func pinnedLANHTTPS() async throws {
guard ProcessInfo.processInfo.environment["HOPE_TLS_LIVE"] == "1" else {
print("HOPE_TLS_PROBE skipped: explicit live opt-in absent")
return
}
print("HOPE_TLS_PROBE native HTTPS validation started")
let (data, response) = try await TLSPinning.session().data(from: URL(string: "https://192.168.86.2:9178/api/auth/me")!)
#expect((response as? HTTPURLResponse)?.statusCode == 401)
#expect(!data.isEmpty)
}
@Test func nativeAccountLogin() async throws {
let env = ProcessInfo.processInfo.environment
guard env["HOPE_TLS_LIVE"] == "1", let username = env["HOPE_TEST_USERNAME"],
let password = env["HOPE_TEST_PASSWORD"] else { return }
print("HOPE_TLS_PROBE native account login started")
let config = try ServerConfig.parse("https://192.168.86.2:9178").get()
let client = AuthClient(config: config)
let login = try await client.login(username: username, password: password)
#expect(login.user.username == username)
#expect(try await client.me(token: login.token).id == login.user.id)
try await client.logout(token: login.token)
print("HOPE_TLS_PROBE native login/me/logout completed")
}
}