forked from strangelove-ventures/horcrux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththreshold_signer.go
39 lines (31 loc) · 1 KB
/
threshold_signer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package signer
import "time"
// Interface for the local signer whether it's a soft sign or HSM
type ThresholdSigner interface {
// PubKey returns the public key bytes for the combination of all cosigners.
PubKey() []byte
// Sign signs a byte payload with the provided nonces.
Sign(nonces []Nonce, payload []byte) ([]byte, error)
// CombineSignatures combines multiple partial signatures to a full signature.
CombineSignatures([]PartialSignature) ([]byte, error)
}
// Nonces contains the ephemeral information generated by one cosigner for all other cosigners.
type Nonces struct {
PubKey []byte
Shares [][]byte
}
type NoncesWithExpiration struct {
Expiration time.Time
Nonces []Nonces
}
// Nonce is the ephemeral information from another cosigner destined for this cosigner.
type Nonce struct {
ID int
Share []byte
PubKey []byte
}
// PartialSignature contains the signature and identifier for a piece of the combined signature.
type PartialSignature struct {
ID int
Signature []byte
}