Documentation
¶
Overview ¶
Package cidoffer - provides functionality like create, verify, sign and get details for CIDOffer and SubCIDOffer structures.
CIDOffer represents an offer from a Storage Provider, explaining on what conditions the client can retrieve a set of uniquely identified files from Filecoin blockchain network. SubCIDOffer represents an offer from a Storage Provider, just like CIDOffer, but for a single file and includes a merkle proof
Package cidoffer - provides functionality like create, verify, sign and get details for CIDOffer and SubCIDOffer structures.
CIDOffer represents an offer from a Storage Provider, explaining on what conditions the client can retrieve a set of uniquely identified files from Filecoin blockchain network. SubCIDOffer represents an offer from a Storage Provider, just like CIDOffer, but for a single file and includes a merkle proof
Index ¶
- type CIDOffer
- func (c *CIDOffer) Copy() *CIDOffer
- func (c *CIDOffer) FromBytes(p []byte) error
- func (c *CIDOffer) GenerateSubCIDOffer(cid *cid.ContentID) (*SubCIDOffer, error)
- func (c *CIDOffer) GetCIDs() []cid.ContentID
- func (c *CIDOffer) GetExpiry() int64
- func (c *CIDOffer) GetMessageDigest() string
- func (c *CIDOffer) GetPrice() *big.Int
- func (c *CIDOffer) GetProviderID() string
- func (c *CIDOffer) GetQoS() uint64
- func (c *CIDOffer) GetSignature() string
- func (c *CIDOffer) HasExpired() bool
- func (c *CIDOffer) SetSignature(sig string)
- func (c *CIDOffer) Sign(privKey string) error
- func (c *CIDOffer) ToBytes() ([]byte, error)
- func (c *CIDOffer) Verify(pubKey string) error
- type SubCIDOffer
- func (c *SubCIDOffer) Copy() *SubCIDOffer
- func (c *SubCIDOffer) FromBytes(p []byte) error
- func (c *SubCIDOffer) GetExpiry() int64
- func (c *SubCIDOffer) GetMerkleProof() *fcrmerkletree.FCRMerkleProof
- func (c *SubCIDOffer) GetMerkleRoot() string
- func (c *SubCIDOffer) GetMessageDigest() string
- func (c *SubCIDOffer) GetPrice() *big.Int
- func (c *SubCIDOffer) GetProviderID() string
- func (c *SubCIDOffer) GetQoS() uint64
- func (c *SubCIDOffer) GetSignature() string
- func (c *SubCIDOffer) GetSubCID() *cid.ContentID
- func (c *SubCIDOffer) HasExpired() bool
- func (c *SubCIDOffer) ToBytes() ([]byte, error)
- func (c *SubCIDOffer) Verify(pubKey string) error
- func (c *SubCIDOffer) VerifyMerkleProof() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIDOffer ¶
type CIDOffer struct {
// contains filtered or unexported fields
}
CIDOffer represents a CID Offer. That is, an offer to deliver content for Piece CID(s) at a certain price.
func NewCIDOffer ¶
func NewCIDOffer(providerID string, cids []cid.ContentID, price *big.Int, expiry int64, qos uint64) (*CIDOffer, error)
NewCidOffer creates an unsigned CID Offer.
func (*CIDOffer) GenerateSubCIDOffer ¶
func (c *CIDOffer) GenerateSubCIDOffer(cid *cid.ContentID) (*SubCIDOffer, error)
GenerateSubCIDOffer is used to generate a sub cid offer with proof for a given cid.
func (*CIDOffer) GetMessageDigest ¶
GetMessageDigest calculate the message digest of this CID Group Offer. Note that the methodology used here should not be externally visible. The message digest should only be used within the system.
func (*CIDOffer) GetProviderID ¶
GetProviderID returns the provider ID of this offer.
func (*CIDOffer) GetSignature ¶
GetSignature returns the signature of this offer.
func (*CIDOffer) HasExpired ¶
HasExpired returns true if the offer expiry date is in the past.
func (*CIDOffer) SetSignature ¶
SetSignature sets the signature of this offer.
type SubCIDOffer ¶
type SubCIDOffer struct {
// contains filtered or unexported fields
}
SubCIDOffer represents a sub CID Offer. That is, part of a CID offer. It contains one sub cid and a merkle proof showing that this sub cid is part of the cid array in the original cid offer.
func NewSubCIDOffer ¶
func NewSubCIDOffer(providerID string, subCID *cid.ContentID, merkleRoot string, merkleProof *fcrmerkletree.FCRMerkleProof, price *big.Int, expiry int64, qos uint64, signature string) *SubCIDOffer
NewSubCIDOffer creates a sub CID Offer.
func (*SubCIDOffer) Copy ¶
func (c *SubCIDOffer) Copy() *SubCIDOffer
Copy returns a copy of the Sub CID Offer
func (*SubCIDOffer) FromBytes ¶
func (c *SubCIDOffer) FromBytes(p []byte) error
FromBytes is used to turn bytes into offer.
func (*SubCIDOffer) GetExpiry ¶
func (c *SubCIDOffer) GetExpiry() int64
GetExpiry returns the expiry of this offer.
func (*SubCIDOffer) GetMerkleProof ¶
func (c *SubCIDOffer) GetMerkleProof() *fcrmerkletree.FCRMerkleProof
GetMerkleProof returns the merkle proof of this offer.
func (*SubCIDOffer) GetMerkleRoot ¶
func (c *SubCIDOffer) GetMerkleRoot() string
GetMerkleRoot returns the merkle root of this offer.
func (*SubCIDOffer) GetMessageDigest ¶
func (c *SubCIDOffer) GetMessageDigest() string
GetMessageDigest calculate the message digest of this sub CID Offer. Note that the methodology used here should not be externally visible. The message digest should only be used within the system.
func (*SubCIDOffer) GetPrice ¶
func (c *SubCIDOffer) GetPrice() *big.Int
GetPrice returns the price of this offer.
func (*SubCIDOffer) GetProviderID ¶
func (c *SubCIDOffer) GetProviderID() string
GetProviderID returns the provider ID of this offer.
func (*SubCIDOffer) GetQoS ¶
func (c *SubCIDOffer) GetQoS() uint64
GetQoS returns the quality of service of this offer.
func (*SubCIDOffer) GetSignature ¶
func (c *SubCIDOffer) GetSignature() string
GetSignature returns the signature of this offer.
func (*SubCIDOffer) GetSubCID ¶
func (c *SubCIDOffer) GetSubCID() *cid.ContentID
GetSubCID returns the sub cid of this offer.
func (*SubCIDOffer) HasExpired ¶
func (c *SubCIDOffer) HasExpired() bool
HasExpired returns true if the offer expiry date is in the past.
func (*SubCIDOffer) ToBytes ¶
func (c *SubCIDOffer) ToBytes() ([]byte, error)
ToBytes is used to turn offer into bytes.
func (*SubCIDOffer) Verify ¶
func (c *SubCIDOffer) Verify(pubKey string) error
Verify is used to verify the offer with a given public key.
func (*SubCIDOffer) VerifyMerkleProof ¶
func (c *SubCIDOffer) VerifyMerkleProof() error
VerifyMerkleProof is used to verify the sub cid is part of the merkle trie