fix: show real identity fingerprint (SHA-256 full format) on Android home screen
Some checks failed
Mirror to GitHub / mirror (push) Failing after 39s
Build Release Binaries / build-amd64 (push) Failing after 1m30s

This commit is contained in:
Siavash Sameni
2026-04-09 09:12:47 +04:00
parent 4c536d256b
commit 3a6ae61f8d
3 changed files with 44 additions and 10 deletions

View File

@@ -159,6 +159,18 @@ class WzpEngine(private val callback: WzpCallback) {
private external fun nativeWriteAudioDirect(handle: Long, buffer: java.nio.ByteBuffer, sampleCount: Int): Int
private external fun nativeReadAudioDirect(handle: Long, buffer: java.nio.ByteBuffer, maxSamples: Int): Int
private external fun nativeDestroy(handle: Long)
companion object {
init { System.loadLibrary("wzp_android") }
/** Get the identity fingerprint for a seed hex. No engine needed. */
@JvmStatic
private external fun nativeGetFingerprint(seedHex: String): String?
/** Compute the full identity fingerprint (xxxx:xxxx:...) from a seed hex string. */
@JvmStatic
fun getFingerprint(seedHex: String): String = nativeGetFingerprint(seedHex) ?: ""
}
private external fun nativePingRelay(handle: Long, relay: String): String?
private external fun nativeStartSignaling(handle: Long, relay: String, seed: String, token: String, alias: String): Int
private external fun nativePlaceCall(handle: Long, targetFp: String): Int
@@ -208,11 +220,6 @@ class WzpEngine(private val callback: WzpCallback) {
return nativeAnswerCall(nativeHandle, callId, mode)
}
companion object {
init {
System.loadLibrary("wzp_android")
}
}
}
/** Integer constants matching the Rust [CallState] enum ordinals. */

View File

@@ -431,14 +431,16 @@ fun InCallScreen(
Spacer(modifier = Modifier.height(20.dp))
// Identity
val fp = if (seedHex.length >= 16) seedHex.take(16) else ""
// Identity — compute real fingerprint from seed
val fullFp = remember(seedHex) {
if (seedHex.length >= 64) com.wzp.engine.WzpEngine.getFingerprint(seedHex) else ""
}
Row(verticalAlignment = Alignment.CenterVertically) {
if (fp.isNotEmpty()) {
Identicon(fingerprint = seedHex, size = 28.dp)
if (fullFp.isNotEmpty()) {
Identicon(fingerprint = fullFp, size = 28.dp)
Spacer(modifier = Modifier.width(8.dp))
CopyableFingerprint(
fingerprint = fp.chunked(4).joinToString(":"),
fingerprint = fullFp,
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace),
color = TextDim
)