Documentation ¶
Index ¶
- Constants
- func ConditionURI(p []byte) (string, error)
- func DefaultFulfillmentEd25519(pubkey *ed25519.PublicKey, sig *ed25519.Signature) *fulfillmentEd25519
- func DefaultFulfillmentThreshold(subs Fulfillments) *fulfillmentThreshold
- func DefaultFulfillmentThresholdFromPrivkeys(msg []byte, privkeys ...crypto.PrivateKey) (_ *fulfillmentThreshold, err error)
- func DefaultFulfillmentThresholdFromPubkeys(pubkeys []crypto.PublicKey) (*fulfillmentThreshold, error)
- func FulfillWithPrivkey(f Fulfillment, msg []byte, privkey crypto.PrivateKey) error
- func FulfillmentThresholdFromPubkeys(pubkeys []crypto.PublicKey, threshold, weight int, weights []int) (*fulfillmentThreshold, error)
- func FulfillmentURI(p []byte) (string, error)
- func NewFulfillment(id int, outer Fulfillment, payload []byte, weight int) *fulfillment
- func NewFulfillmentEd25519(pubkey *ed25519.PublicKey, sig *ed25519.Signature, weight int) *fulfillmentEd25519
- func NewFulfillmentPreImage(preimage []byte, weight int) *fulfillmentPreImage
- func NewFulfillmentPrefix(prefix []byte, sub Fulfillment, weight int) *fulfillmentPrefix
- func NewFulfillmentRSA(pubkey *rsa.PublicKey, sig *rsa.Signature, weight int) *fulfillmentRSA
- func NewFulfillmentThreshold(subs Fulfillments, threshold, weight int) *fulfillmentThreshold
- func NewFulfillmentTimeout(expires int64, weight int) *fulfillmentTimeout
- func Sum256(p []byte) []byte
- func ThresholdBitmask(subs Fulfillments) int
- func ThresholdHash(subs Fulfillments, threshold int) []byte
- func ThresholdPayload(subs Fulfillments, threshold int) []byte
- func ThresholdSize(subs Fulfillments, threshold int) int
- type Condition
- func (f Condition) Bitmask() int
- func (f Condition) Data() Data
- func (c *Condition) FromString(uri string) (err error)
- func (f Condition) Hash() []byte
- func (f Condition) Id() int
- func (f Condition) Init()
- func (c *Condition) IsCondition() bool
- func (c *Condition) MarshalBinary() ([]byte, error)
- func (f Condition) PublicKey() crypto.PublicKey
- func (f Condition) Signature() crypto.Signature
- func (f Condition) Size() int
- func (c *Condition) String() string
- func (f Condition) Subfulfillments() Fulfillments
- func (c *Condition) UnmarshalBinary(p []byte) (err error)
- func (f Condition) Validate(p []byte) bool
- func (f Condition) Weight() int
- type Fulfillment
- func DefaultFulfillmentFromPrivkey(msg []byte, privkey crypto.PrivateKey) (Fulfillment, error)
- func DefaultFulfillmentFromPubkey(pubkey crypto.PublicKey) (Fulfillment, error)
- func DefaultUnmarshalBinary(p []byte) (Fulfillment, error)
- func DefaultUnmarshalURI(uri string) (Fulfillment, error)
- func FulfillmentFromPrivkey(msg []byte, privkey crypto.PrivateKey, weight int) (Fulfillment, error)
- func FulfillmentFromPubKey(pubkey crypto.PublicKey, weight int) (Fulfillment, error)
- func UnmarshalBinary(p []byte, weight int) (f Fulfillment, err error)
- func UnmarshalURI(uri string, weight int) (f Fulfillment, err error)
- type Fulfillments
- func DefaultFulfillmentsFromPrivkeys(msgs [][]byte, privkeys []crypto.PrivateKey) (_ Fulfillments, err error)
- func DefaultFulfillmentsFromPubkeys(pubkeys []crypto.PublicKey) (_ Fulfillments, err error)
- func FulfillmentsFromPrivkeys(msgs [][]byte, privkeys []crypto.PrivateKey, weights []int) (_ Fulfillments, err error)
- func FulfillmentsFromPubkeys(pubkeys []crypto.PublicKey, weights []int) (_ Fulfillments, err error)
- func ThresholdSubs(p []byte) (Fulfillments, int, error)
Constants ¶
View Source
const ( // Params HASH_SIZE = 32 MAX_PAYLOAD_SIZE = 0xfff SUPPORTED_BITMASK = 0x3f PREIMAGE_ID = 0 PREIMAGE_BITMASK = 0x03 PREFIX_ID = 1 PREFIX_BITMASK = 0x05 THRESHOLD_ID = 2 THRESHOLD_BITMASK = 0x09 RSA_ID = 3 RSA_BITMASK = 0x11 RSA_SIZE = rsa.KEY_SIZE + rsa.SIGNATURE_SIZE ED25519_ID = 4 ED25519_BITMASK = 0x20 ED25519_SIZE = ed25519.PUBKEY_SIZE + ed25519.SIGNATURE_SIZE TIMEOUT_ID = 5 TIMEOUT_BITMASK = 0x00 )
Variables ¶
This section is empty.
Functions ¶
func ConditionURI ¶
func DefaultFulfillmentThreshold ¶
func DefaultFulfillmentThreshold(subs Fulfillments) *fulfillmentThreshold
func DefaultFulfillmentThresholdFromPrivkeys ¶
func DefaultFulfillmentThresholdFromPrivkeys(msg []byte, privkeys ...crypto.PrivateKey) (_ *fulfillmentThreshold, err error)
For testing..
func FulfillWithPrivkey ¶
func FulfillWithPrivkey(f Fulfillment, msg []byte, privkey crypto.PrivateKey) error
func FulfillmentURI ¶
func NewFulfillment ¶
func NewFulfillment(id int, outer Fulfillment, payload []byte, weight int) *fulfillment
func NewFulfillmentEd25519 ¶
func NewFulfillmentPreImage ¶
func NewFulfillmentPrefix ¶
func NewFulfillmentPrefix(prefix []byte, sub Fulfillment, weight int) *fulfillmentPrefix
func NewFulfillmentRSA ¶
func NewFulfillmentThreshold ¶
func NewFulfillmentThreshold(subs Fulfillments, threshold, weight int) *fulfillmentThreshold
func NewFulfillmentTimeout ¶
func ThresholdBitmask ¶
func ThresholdBitmask(subs Fulfillments) int
func ThresholdHash ¶
func ThresholdHash(subs Fulfillments, threshold int) []byte
Sort subconditions then hash them..
func ThresholdPayload ¶
func ThresholdPayload(subs Fulfillments, threshold int) []byte
func ThresholdSize ¶
func ThresholdSize(subs Fulfillments, threshold int) int
Types ¶
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
func GetCondition ¶
func GetCondition(f Fulfillment) *Condition
func NewCondition ¶
func NilCondition ¶
func NilCondition() *Condition
func (*Condition) FromString ¶
func (*Condition) IsCondition ¶
func (*Condition) MarshalBinary ¶
func (Condition) Subfulfillments ¶
func (f Condition) Subfulfillments() Fulfillments
func (*Condition) UnmarshalBinary ¶
type Fulfillment ¶
type Fulfillment interface { Bitmask() int Data() Data FromString(string) error Hash() []byte Id() int Init() IsCondition() bool MarshalBinary() ([]byte, error) PublicKey() crypto.PublicKey Signature() crypto.Signature Size() int String() string Subfulfillments() Fulfillments UnmarshalBinary([]byte) error Validate([]byte) bool Weight() int }
func DefaultFulfillmentFromPrivkey ¶
func DefaultFulfillmentFromPrivkey(msg []byte, privkey crypto.PrivateKey) (Fulfillment, error)
func DefaultFulfillmentFromPubkey ¶
func DefaultFulfillmentFromPubkey(pubkey crypto.PublicKey) (Fulfillment, error)
func DefaultUnmarshalBinary ¶
func DefaultUnmarshalBinary(p []byte) (Fulfillment, error)
func DefaultUnmarshalURI ¶
func DefaultUnmarshalURI(uri string) (Fulfillment, error)
func FulfillmentFromPrivkey ¶
func FulfillmentFromPrivkey(msg []byte, privkey crypto.PrivateKey, weight int) (Fulfillment, error)
func FulfillmentFromPubKey ¶
func FulfillmentFromPubKey(pubkey crypto.PublicKey, weight int) (Fulfillment, error)
func UnmarshalBinary ¶
func UnmarshalBinary(p []byte, weight int) (f Fulfillment, err error)
func UnmarshalURI ¶
func UnmarshalURI(uri string, weight int) (f Fulfillment, err error)
type Fulfillments ¶
type Fulfillments []Fulfillment
func DefaultFulfillmentsFromPrivkeys ¶
func DefaultFulfillmentsFromPrivkeys(msgs [][]byte, privkeys []crypto.PrivateKey) (_ Fulfillments, err error)
func DefaultFulfillmentsFromPubkeys ¶
func DefaultFulfillmentsFromPubkeys(pubkeys []crypto.PublicKey) (_ Fulfillments, err error)
func FulfillmentsFromPrivkeys ¶
func FulfillmentsFromPrivkeys(msgs [][]byte, privkeys []crypto.PrivateKey, weights []int) (_ Fulfillments, err error)
func FulfillmentsFromPubkeys ¶
func FulfillmentsFromPubkeys(pubkeys []crypto.PublicKey, weights []int) (_ Fulfillments, err error)
func ThresholdSubs ¶
func ThresholdSubs(p []byte) (Fulfillments, int, error)
func (Fulfillments) Len ¶
func (fs Fulfillments) Len() int
func (Fulfillments) Less ¶
func (fs Fulfillments) Less(i, j int) bool
sort in `descending` order by weights, then lexicographically
func (Fulfillments) Swap ¶
func (fs Fulfillments) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.