Versions in this module Expand all Collapse all v1 v1.0.7 Feb 16, 2024 v1.0.6 Jan 24, 2024 Changes in this version + const PubNonceSize + const SecNonceSize + var ChallengeHashTag = []byte("BIP0340/challenge") + var ErrAlreadyHaveAllNonces = fmt.Errorf("already have all nonces") + var ErrAlreadyHaveAllSigners = fmt.Errorf("all signers registered") + var ErrAlredyHaveAllSigs = fmt.Errorf("already have all sigs") + var ErrCombinedNonceUnavailable = fmt.Errorf("missing combined nonce") + var ErrFinalSigInvalid = fmt.Errorf("final signature is invalid") + var ErrNoEarlyNonce = fmt.Errorf("no early nonce available") + var ErrNoncePointAtInfinity = fmt.Errorf(...) + var ErrNotEnoughSigners = fmt.Errorf("not enough signers") + var ErrPartialSigInvalid = fmt.Errorf("partial signature is invalid") + var ErrPubkeyInvalid = errors.New("nonce generation requires a valid pubkey") + var ErrPubkeyNotIncluded = fmt.Errorf(...) + var ErrSecKeyZero = fmt.Errorf("priv key is zero") + var ErrSecNoncePubkey = fmt.Errorf("public key does not match secnonce") + var ErrSecretNonceZero = fmt.Errorf("secret nonce is blank") + var ErrSignerNotInKeySet = fmt.Errorf(...) + var ErrSignersNotSpecified = fmt.Errorf(...) + var ErrSigningContextReuse = fmt.Errorf("nonce already used") + var ErrTaprootInternalKeyUnavailable = fmt.Errorf("taproot tweak not used") + var ErrTweakedKeyIsInfinity = fmt.Errorf("tweaked key is infinity point") + var ErrTweakedKeyOverflows = fmt.Errorf("tweaked key is too large") + var KeyAggTagCoeff = []byte("KeyAgg coefficient") + var KeyAggTagList = []byte("KeyAgg list") + var NonceAuxTag = []byte("MuSig/aux") + var NonceBlindTag = []byte("MuSig/noncecoef") + var NonceGenTag = []byte("MuSig/nonce") + var WithNoncePrivateKeyAux = WithNonceSecretKeyAux + func AggregateNonces(pubNonces [][PubNonceSize]byte) ([PubNonceSize]byte, error) + func CombineSigs(combinedNonce *ec.PublicKey, partialSigs []*PartialSignature, ...) *schnorr.Signature + type AggregateKey struct + FinalKey *ec.PublicKey + PreTweakedKey *ec.PublicKey + func AggregateKeys(keys []*ec.PublicKey, sort bool, keyOpts ...KeyAggOption) (*AggregateKey, *ec.ModNScalar, *ec.ModNScalar, error) + type CombineOption func(*combineOptions) + func WithBip86TweakedCombine(msg [32]byte, keys []*ec.PublicKey, sort bool) CombineOption + func WithTaprootTweakedCombine(msg [32]byte, keys []*ec.PublicKey, scriptRoot []byte, sort bool) CombineOption + func WithTweakedCombine(msg [32]byte, keys []*ec.PublicKey, tweaks []KeyTweakDesc, sort bool) CombineOption + type Context struct + func NewContext(signingKey *ec.SecretKey, shouldSort bool, ctxOpts ...ContextOption) (*Context, error) + func (c *Context) CombinedKey() (*ec.PublicKey, error) + func (c *Context) EarlySessionNonce() (*Nonces, error) + func (c *Context) NewSession(options ...SessionOption) (*Session, error) + func (c *Context) NumRegisteredSigners() int + func (c *Context) PubKey() ec.PublicKey + func (c *Context) RegisterSigner(pub *ec.PublicKey) (bool, error) + func (c *Context) SigningKeys() []*ec.PublicKey + func (c *Context) TaprootInternalKey() (*ec.PublicKey, error) + type ContextOption func(*contextOptions) + func WithBip86TweakCtx() ContextOption + func WithEarlyNonceGen() ContextOption + func WithKnownSigners(signers []*ec.PublicKey) ContextOption + func WithNumSigners(n int) ContextOption + func WithTaprootTweakCtx(scriptRoot []byte) ContextOption + func WithTweakedContext(tweaks ...KeyTweakDesc) ContextOption + type KeyAggOption func(*keyAggOption) + func WithBIP86KeyTweak() KeyAggOption + func WithKeyTweaks(tweaks ...KeyTweakDesc) KeyAggOption + func WithKeysHash(keyHash []byte) KeyAggOption + func WithTaprootKeyTweak(scriptRoot []byte) KeyAggOption + func WithUniqueKeyIndex(idx int) KeyAggOption + type KeyTweakDesc struct + IsXOnly bool + Tweak [32]byte + type NonceGenOption func(*nonceGenOpts) + func WithCustomRand(r io.Reader) NonceGenOption + func WithNonceAuxInput(aux []byte) NonceGenOption + func WithNonceCombinedKeyAux(combinedKey *ec.PublicKey) NonceGenOption + func WithNonceMessageAux(msg [32]byte) NonceGenOption + func WithNonceSecretKeyAux(secKey *ec.SecretKey) NonceGenOption + func WithPublicKey(pubKey *ec.PublicKey) NonceGenOption + type Nonces struct + PubNonce [PubNonceSize]byte + SecNonce [SecNonceSize]byte + func GenNonces(options ...NonceGenOption) (*Nonces, error) + type PartialSignature struct + R *ec.PublicKey + S *ec.ModNScalar + func NewPartialSignature(s *ec.ModNScalar, r *ec.PublicKey) PartialSignature + func Sign(secNonce [SecNonceSize]byte, privKey *ec.SecretKey, ...) (*PartialSignature, error) + func (p *PartialSignature) Decode(r io.Reader) error + func (p *PartialSignature) Encode(w io.Writer) error + func (p *PartialSignature) Verify(pubNonce [PubNonceSize]byte, combinedNonce [PubNonceSize]byte, ...) bool + type Session struct + func (s *Session) CombineSig(sig *PartialSignature) (bool, error) + func (s *Session) FinalSig() *schnorr.Signature + func (s *Session) NumRegisteredNonces() int + func (s *Session) PublicNonce() [PubNonceSize]byte + func (s *Session) RegisterPubNonce(nonce [PubNonceSize]byte) (bool, error) + func (s *Session) Sign(msg [32]byte, signOpts ...SignOption) (*PartialSignature, error) + type SessionOption func(*sessionOptions) + func WithPreGeneratedNonce(nonce *Nonces) SessionOption + type SignOption func(*signOptions) + func WithBip86SignTweak() SignOption + func WithFastSign() SignOption + func WithSortedKeys() SignOption + func WithTaprootSignTweak(scriptRoot []byte) SignOption + func WithTweaks(tweaks ...KeyTweakDesc) SignOption