Show key debug info in visible Connection Log
This commit is contained in:
parent
661a668169
commit
5b140362bf
|
|
@ -121,10 +121,14 @@ class DeviceIdentity(context: Context) {
|
||||||
|
|
||||||
Log.d(tag, "Generated signature: ${signatureBase64.take(20)}... (${signatureBytes.size} bytes)")
|
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(
|
return SignedChallenge(
|
||||||
signature = signatureBase64,
|
signature = signatureBase64,
|
||||||
signedAt = signedAt,
|
signedAt = signedAt,
|
||||||
nonce = nonce
|
nonce = nonce,
|
||||||
|
debugInfo = debugInfo
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,6 +207,7 @@ class DeviceIdentity(context: Context) {
|
||||||
data class SignedChallenge(
|
data class SignedChallenge(
|
||||||
val signature: String,
|
val signature: String,
|
||||||
val signedAt: Long,
|
val signedAt: Long,
|
||||||
val nonce: String
|
val nonce: String,
|
||||||
|
val debugInfo: String = "" // For debugging key derivation
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,8 @@ class GatewayClient(
|
||||||
deviceId = deviceIdentity.deviceId
|
deviceId = deviceIdentity.deviceId
|
||||||
signedChallenge = deviceIdentity.signChallenge(nonce)
|
signedChallenge = deviceIdentity.signChallenge(nonce)
|
||||||
publicKey = deviceIdentity.publicKey
|
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) {
|
} catch (e: Exception) {
|
||||||
logError("Failed to initialize device identity or sign challenge", e)
|
logError("Failed to initialize device identity or sign challenge", e)
|
||||||
// Cannot proceed without device identity for non-local connections
|
// Cannot proceed without device identity for non-local connections
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue