cidoffer

package
v0.0.0-...-7a4b066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

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

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) Copy

func (c *CIDOffer) Copy() *CIDOffer

Copy returns a copy of the CID Offer

func (*CIDOffer) FromBytes

func (c *CIDOffer) FromBytes(p []byte) error

FromBytes is used to turn bytes into 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) GetCIDs

func (c *CIDOffer) GetCIDs() []cid.ContentID

GetCIDs returns the cids of this offer.

func (*CIDOffer) GetExpiry

func (c *CIDOffer) GetExpiry() int64

GetExpiry returns the expiry of this offer.

func (*CIDOffer) GetMessageDigest

func (c *CIDOffer) GetMessageDigest() string

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) GetPrice

func (c *CIDOffer) GetPrice() *big.Int

GetPrice returns the price of this offer.

func (*CIDOffer) GetProviderID

func (c *CIDOffer) GetProviderID() string

GetProviderID returns the provider ID of this offer.

func (*CIDOffer) GetQoS

func (c *CIDOffer) GetQoS() uint64

GetQoS returns the quality of service of this offer.

func (*CIDOffer) GetSignature

func (c *CIDOffer) GetSignature() string

GetSignature returns the signature of this offer.

func (*CIDOffer) HasExpired

func (c *CIDOffer) HasExpired() bool

HasExpired returns true if the offer expiry date is in the past.

func (*CIDOffer) SetSignature

func (c *CIDOffer) SetSignature(sig string)

SetSignature sets the signature of this offer.

func (*CIDOffer) Sign

func (c *CIDOffer) Sign(privKey string) error

Sign is used to sign the offer with a given private key.

func (*CIDOffer) ToBytes

func (c *CIDOffer) ToBytes() ([]byte, error)

ToBytes is used to turn offer into bytes.

func (*CIDOffer) Verify

func (c *CIDOffer) Verify(pubKey string) error

Verify is used to verify the offer with a given public key.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL