arbitration

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

package arbitration

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

Package arbitration 实现 v3 卖方仲裁签名工作流。 仲裁工作流验证买方的最终授权和卖方候选交易,然后仅添加 Arbiter 签名; 不负责内容定价、交易构造或接收 005 买方签名。

Index

Constants

const MajorVersion uint64 = 3

Functions

func MarshalRequest

func MarshalRequest(request *ArbitrationRequest) ([]byte, error)

func MarshalResponse

func MarshalResponse(response *ArbitrationResponse) ([]byte, error)

func ValidateRequest

func ValidateRequest(request *ArbitrationRequest) error

func ValidateResponse

func ValidateResponse(response *ArbitrationResponse) error

Types

type ArbitrationRequest

type ArbitrationRequest struct {
	Version                    uint64
	PoolOpeningProofCBOR       []byte
	PaymentAuthorizationCBOR   []byte
	UnsignedStateTxRaw         []byte
	SellerTransactionSignature []byte
}

ArbitrationRequest is the complete v3 wire request. All transaction bytes are unsigned-template bytes; the seller signature is deliberately separate.

func UnmarshalRequest
func UnmarshalRequest(data []byte) (*ArbitrationRequest, error)

type ArbitrationResponse

type ArbitrationResponse struct {
	Version                     uint64
	PaymentAuthorizationHash    []byte
	UnsignedStateTxHash         []byte
	ArbiterTransactionSignature []byte
}
func UnmarshalResponse
func UnmarshalResponse(data []byte) (*ArbitrationResponse, error)

type PoolPort

type PoolPort interface {
	VerifyOpening(*pool.OpeningProof) error
	VerifyArbitrationCandidate(context.Context, []byte, *pool.OpeningProof, *bitfs.ContentRequestTerms, []byte) (*pool.UnsignedPayment, error)
	SignArbitrationCandidate(context.Context, []byte, *pool.OpeningProof, pool.Signer) ([]byte, error)
}

PoolPort 是仲裁工作流所需的唯一交易能力端口。 实现必须使用 MultisigPool 验证交易,不得修改候选交易或构造替代交易; Seller 验证通过后,由 Arbiter 提供 Arbiter 角色签名。

type Workflow

type Workflow struct {
	// contains filtered or unexported fields
}
func NewWorkflow
func NewWorkflow(config WorkflowConfig) (*Workflow, error)
func (*Workflow) SignPayment
func (workflow *Workflow) SignPayment(ctx context.Context, request *ArbitrationRequest) (*ArbitrationResponse, error)

type WorkflowConfig

type WorkflowConfig struct {
	Signer                pool.Signer
	Pool                  PoolPort
	AuthorizationVerifier bitfs.ContentTermsSignatureVerifier
}