Show key debug info in visible Connection Log

This commit is contained in:
James (ClawdBot) 2026-01-28 18:59:32 +00:00
parent 661a668169
commit 5b140362bf
2 changed files with 9 additions and 3 deletions

View File

@ -121,10 +121,14 @@ class DeviceIdentity(context: Context) {
Log.d(tag, "Generated signature: ${signatureBase64.take(20)}... (${signatureBytes.size} bytes)")
val keysMatch = derivedPubKey.contentEquals(storedPubKey)
val debugInfo = "Keys match: $keysMatch | Stored: ${storedPubKeyBase64?.take(12)}... | Derived: ${base64UrlEncode(derivedPubKey).take(12)}..."
return SignedChallenge(
signature = signatureBase64,
signedAt = signedAt,
nonce = nonce
nonce = nonce,
debugInfo = debugInfo
)
}
@ -203,6 +207,7 @@ class DeviceIdentity(context: Context) {
data class SignedChallenge(
val signature: String,
val signedAt: Long,
val nonce: String
val nonce: String,
val debugInfo: String = "" // For debugging key derivation
)
}

View File

@ -228,7 +228,8 @@ class GatewayClient(
deviceId = deviceIdentity.deviceId
signedChallenge = deviceIdentity.signChallenge(nonce)
publicKey = deviceIdentity.publicKey
log("Device identity ready: id=${deviceId.take(8)}..., signed challenge")
log("Device identity ready: id=${deviceId.take(8)}...")
log("DEBUG: ${signedChallenge.debugInfo}")
} catch (e: Exception) {
logError("Failed to initialize device identity or sign challenge", e)
// Cannot proceed without device identity for non-local connections