fix(android): remove 0x prefix from messageHash before TSS sign
TSS native library expects pure hex string without 0x prefix. Fix both startSigning (initiator) and executeSignAsJoiner (joiner) functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
0bd764e1d1
commit
001f0ac480
|
|
@ -1216,6 +1216,13 @@ class TssRepository @Inject constructor(
|
|||
android.util.Log.d("TssRepository", "Starting TSS sign with ${allParticipants.size} participants, thresholdT=$thresholdT")
|
||||
|
||||
// Start TSS sign
|
||||
// Remove 0x prefix from messageHash - TSS library expects pure hex
|
||||
val cleanMessageHash = if (messageHash.startsWith("0x") || messageHash.startsWith("0X")) {
|
||||
messageHash.substring(2)
|
||||
} else {
|
||||
messageHash
|
||||
}
|
||||
android.util.Log.d("TssRepository", "Starting TSS sign with cleanMessageHash=${cleanMessageHash.take(20)}...")
|
||||
val startResult = tssNativeBridge.startSign(
|
||||
sessionId = sessionId,
|
||||
partyId = partyId,
|
||||
|
|
@ -1223,7 +1230,7 @@ class TssRepository @Inject constructor(
|
|||
thresholdT = thresholdT,
|
||||
thresholdN = shareEntity.thresholdN, // Use original N from keygen
|
||||
participants = allParticipants,
|
||||
messageHash = messageHash,
|
||||
messageHash = cleanMessageHash,
|
||||
shareData = shareEntity.encryptedShare,
|
||||
password = password
|
||||
)
|
||||
|
|
@ -2158,7 +2165,14 @@ class TssRepository @Inject constructor(
|
|||
}
|
||||
|
||||
// Start TSS sign
|
||||
android.util.Log.d("TssRepository", "[CO-SIGN] Calling tssNativeBridge.startSign...")
|
||||
// Remove 0x prefix from messageHash - TSS library expects pure hex
|
||||
val rawMessageHash = session.messageHash ?: ""
|
||||
val cleanMessageHash = if (rawMessageHash.startsWith("0x") || rawMessageHash.startsWith("0X")) {
|
||||
rawMessageHash.substring(2)
|
||||
} else {
|
||||
rawMessageHash
|
||||
}
|
||||
android.util.Log.d("TssRepository", "[CO-SIGN] Calling tssNativeBridge.startSign with cleanMessageHash=${cleanMessageHash.take(20)}...")
|
||||
val startResult = tssNativeBridge.startSign(
|
||||
sessionId = sessionId,
|
||||
partyId = partyId,
|
||||
|
|
@ -2166,7 +2180,7 @@ class TssRepository @Inject constructor(
|
|||
thresholdT = session.thresholdT,
|
||||
thresholdN = shareEntity.thresholdN,
|
||||
participants = session.participants,
|
||||
messageHash = session.messageHash ?: "",
|
||||
messageHash = cleanMessageHash,
|
||||
shareData = shareEntity.encryptedShare,
|
||||
password = password
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue