seller

由 doc2go 直接从当前 Go 源码与 doc comments 生成。

package seller

import "github.com/bsv8/go-bitfs/seller"

Package seller implements the seller-side BitFS v3 workflow.

A Workflow creates signed quotes, coordinates pool opening, validates content requests, delivers signed content, advances cumulative payments, and prepares arbitration evidence. Wallet, storage, content, transaction, and node capabilities remain application-owned and are supplied through WorkflowConfig.

Index

Types

type ContentSource

type ContentSource interface {
	LoadContent(context.Context, bitfs.Hash32) ([]byte, error)
}

type QuoteStore

type QuoteStore interface {
	SaveQuote(context.Context, *bitfs.SignedFileQuote) error
	LoadQuote(context.Context, bitfs.Hash32) (*bitfs.SignedFileQuote, error)
}

type Workflow

type Workflow struct {
	// contains filtered or unexported fields
}
func NewWorkflow
func NewWorkflow(config WorkflowConfig) (*Workflow, error)
func (*Workflow) AcceptPayment
func (workflow *Workflow) AcceptPayment(ctx context.Context, update *pool.PaymentUpdate) (*pool.PaymentState, error)
func (*Workflow) AcceptPoolFunding
func (workflow *Workflow) AcceptPoolFunding(ctx context.Context, delivery *pool.FundingTxDelivery) (*pool.OpeningProof, error)
func (*Workflow) BuildArbitrationRequest
func (workflow *Workflow) BuildArbitrationRequest(context.Context, *pool.OpeningProof, *pool.PaymentUpdate) (*arbitration.ArbitrationRequest, error)

BuildArbitrationRequest is intentionally disabled: arbitration must be built from the signed 003 authorization, never from a buyer payment wrapper.

func (*Workflow) BuildArbitrationRequestFromAuthorization
func (workflow *Workflow) BuildArbitrationRequestFromAuthorization(ctx context.Context, proof *pool.OpeningProof, authorization *bitfs.SignedContentRequest, latest *pool.PaymentState) (*arbitration.ArbitrationRequest, error)
func (*Workflow) CreateQuote
func (workflow *Workflow) CreateQuote(ctx context.Context, draft bitfs.FileQuoteTerms, recommendedFilename string) (*bitfs.SignedFileQuote, error)
func (*Workflow) DeliverRequestedContent
func (workflow *Workflow) DeliverRequestedContent(ctx context.Context, request *bitfs.SignedContentRequest) (delivery *bitfs.SignedContentDelivery, err error)
func (*Workflow) PresignPoolOpening
func (workflow *Workflow) PresignPoolOpening(ctx context.Context, request *pool.RefundPresignRequest) (*pool.RefundPresignResponse, error)
func (*Workflow) SignImmediateClose
func (workflow *Workflow) SignImmediateClose(ctx context.Context, unsigned *pool.UnsignedPayment, buyerSig []byte, _ pool.Signer) (*pool.SignedPayment, error)

SignImmediateClose complements the buyer's final close signature. It does not submit or alter pool state; the buyer decides when to call SubmitFinal.

func (*Workflow) SubmitArbitratedPayment
func (workflow *Workflow) SubmitArbitratedPayment(ctx context.Context, request *arbitration.ArbitrationRequest, response *arbitration.ArbitrationResponse) (*pool.PaymentState, error)

type WorkflowConfig

type WorkflowConfig struct {
	Signer            pool.Signer
	SignatureVerifier bitfs.ContentTermsSignatureVerifier
	QuoteVerifier     bitfs.QuoteTermsSignatureVerifier
	Clock             func() time.Time
	Quotes            QuoteStore
	Pools             pool.PoolStore
	OpeningHooks      pool.SellerPoolOpeningHooks
	Pending           pool.PendingRequestStore
	Content           ContentSource
	Transactions      pool.SellerPoolPort
	Participants      pool.ParticipantVerifier
	Node              pool.NonFinalPoolNode
}