fix(co-sign): validate exactly t parties for t-of-n signing
For threshold signing, exactly t parties are required: - 3-of-5 → 3 parties - 2-of-3 → 2 parties - 4-of-7 → 4 parties 🤖 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
ebbc483b35
commit
cfbda7bbc7
|
|
@ -499,10 +499,10 @@ func (h *CoManagedHTTPHandler) CreateSignSession(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Validate party count >= threshold + 1
|
||||
if len(req.Parties) < req.ThresholdT+1 {
|
||||
// Validate party count == threshold_t (for t-of-n signing, exactly t parties are needed)
|
||||
if len(req.Parties) != req.ThresholdT {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"error": fmt.Sprintf("need at least %d parties for threshold %d", req.ThresholdT+1, req.ThresholdT),
|
||||
"error": fmt.Sprintf("need exactly %d parties for threshold %d, got %d", req.ThresholdT, req.ThresholdT, len(req.Parties)),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue