Documentation
¶
Index ¶
- Constants
- Variables
- func AddSignatureToInputs(inputs cashu.Proofs, signingKey *btcec.PrivateKey) (cashu.Proofs, error)
- func AddSignatureToOutputs(outputs cashu.BlindedMessages, signingKey *btcec.PrivateKey) (cashu.BlindedMessages, error)
- func CanSign(secret nut10.WellKnownSecret, key *btcec.PrivateKey) bool
- func DuplicateSignatures(signatures []string) bool
- func HasValidSignatures(hash []byte, signatures []string, Nsigs int, pubkeys []*btcec.PublicKey) bool
- func IsSigAll(secret nut10.WellKnownSecret) bool
- func ParsePublicKey(key string) (*btcec.PublicKey, error)
- func ParseSignature(signature string) (*schnorr.Signature, error)
- func ProofsSigAll(proofs cashu.Proofs) bool
- func PublicKeys(secret nut10.WellKnownSecret) ([]*btcec.PublicKey, error)
- func SerializeP2PKTags(p2pkTags P2PKTags) [][]string
- type P2PKTags
- type P2PKWitness
Constants ¶
View Source
const ( // supported tags SIGFLAG = "sigflag" NSIGS = "n_sigs" PUBKEYS = "pubkeys" LOCKTIME = "locktime" REFUND = "refund" // SIGFLAG types SIGINPUTS = "SIG_INPUTS" SIGALL = "SIG_ALL" // Error code NUT11ErrCode cashu.CashuErrCode = 30001 )
Variables ¶
View Source
var ( InvalidTagErr = cashu.Error{Detail: "invalid tag", Code: NUT11ErrCode} TooManyTagsErr = cashu.Error{Detail: "too many tags", Code: NUT11ErrCode} NSigsMustBePositiveErr = cashu.Error{Detail: "n_sigs must be a positive integer", Code: NUT11ErrCode} EmptyPubkeysErr = cashu.Error{Detail: "pubkeys tag cannot be empty if n_sigs tag is present", Code: NUT11ErrCode} InvalidWitness = cashu.Error{Detail: "invalid witness", Code: NUT11ErrCode} InvalidKindErr = cashu.Error{Detail: "invalid kind in secret", Code: NUT11ErrCode} DuplicateSignaturesErr = cashu.Error{Detail: "witness has duplicate signatures", Code: NUT11ErrCode} NotEnoughSignaturesErr = cashu.Error{Detail: "not enough valid signatures provided", Code: NUT11ErrCode} NoSignaturesErr = cashu.Error{Detail: "no signatures provided in witness", Code: NUT11ErrCode} AllSigAllFlagsErr = cashu.Error{Detail: "all flags must be SIG_ALL", Code: NUT11ErrCode} SigAllKeysMustBeEqualErr = cashu.Error{Detail: "all public keys must be the same for SIG_ALL", Code: NUT11ErrCode} SigAllOnlySwap = cashu.Error{Detail: "SIG_ALL can only be used in /swap operation", Code: NUT11ErrCode} NSigsMustBeEqualErr = cashu.Error{Detail: "all n_sigs must be the same for SIG_ALL", Code: NUT11ErrCode} )
NUT-11 specific errors
Functions ¶
func AddSignatureToInputs ¶
func AddSignatureToOutputs ¶
func AddSignatureToOutputs( outputs cashu.BlindedMessages, signingKey *btcec.PrivateKey, ) (cashu.BlindedMessages, error)
func CanSign ¶
func CanSign(secret nut10.WellKnownSecret, key *btcec.PrivateKey) bool
func DuplicateSignatures ¶ added in v0.3.0
func HasValidSignatures ¶ added in v0.3.0
func IsSigAll ¶
func IsSigAll(secret nut10.WellKnownSecret) bool
func ParsePublicKey ¶ added in v0.3.0
func ParseSignature ¶ added in v0.3.0
func ProofsSigAll ¶ added in v0.3.0
ProofsSigAll returns true if at least one of the proofs in the list has a SIG_ALL flag
func PublicKeys ¶ added in v0.3.0
func PublicKeys(secret nut10.WellKnownSecret) ([]*btcec.PublicKey, error)
PublicKeys returns a list of public keys that can sign a P2PK or HTLC proof
func SerializeP2PKTags ¶ added in v0.3.0
Types ¶
type P2PKTags ¶ added in v0.3.0
type P2PKTags struct { Sigflag string NSigs int Pubkeys []*btcec.PublicKey Locktime int64 Refund []*btcec.PublicKey }
func ParseP2PKTags ¶ added in v0.3.0
type P2PKWitness ¶
type P2PKWitness struct {
Signatures []string `json:"signatures"`
}
Click to show internal directories.
Click to hide internal directories.