arbitration
import "github.com/bsv8/go-bitfs/arbitration"
Package arbitration implements the BitFS v3 seller-arbitration signing workflow. It verifies the buyer authorization and seller candidate transaction, then adds only the arbiter signature. It does not price content, construct transactions, or receive the 005 buyer signature.
Index
- Constants
- func MarshalRequest(request *ArbitrationRequest) ([]byte, error)
- func MarshalResponse(response *ArbitrationResponse) ([]byte, error)
- func ValidateRequest(request *ArbitrationRequest) error
- func ValidateResponse(response *ArbitrationResponse) error
- type ArbitrationRequest
- type ArbitrationResponse
- type PoolPort
- type Workflow
- type WorkflowConfig
Constants
MajorVersion is the current major version of the pool workflow protocol.
const MajorVersion uint64 = 3
func MarshalRequest
func MarshalRequest(request *ArbitrationRequest) ([]byte, error)
MarshalRequest validates and encodes a five-field 007 arbitration request.
func MarshalResponse
func MarshalResponse(response *ArbitrationResponse) ([]byte, error)
MarshalResponse validates and encodes a four-field 007 arbitration response.
func ValidateRequest
func ValidateRequest(request *ArbitrationRequest) error
ValidateRequest checks the 007 version, required CBOR/transaction byte fields, SHA-256 hash lengths, and detached seller signature before decoding evidence.
func ValidateResponse
func ValidateResponse(response *ArbitrationResponse) error
ValidateResponse checks the 007 response version, authorization/state hashes, and detached arbiter signature lengths before a caller accepts the response.
type ArbitrationRequest
ArbitrationRequest is the complete v3 wire request. All transaction bytes are unsigned-template bytes; the seller signature is deliberately separate.
type ArbitrationRequest struct {
Version uint64
PoolOpeningProofCBOR []byte
PaymentAuthorizationCBOR []byte
UnsignedStateTxRaw []byte
SellerTransactionSignature []byte
}
func UnmarshalRequest
func UnmarshalRequest(data []byte) (*ArbitrationRequest, error)
UnmarshalRequest strictly decodes and canonicalizes a 007 arbitration request.
type ArbitrationResponse
ArbitrationResponse contains the arbiter decision signature and resulting payment transaction.
type ArbitrationResponse struct {
Version uint64
PaymentAuthorizationHash []byte
UnsignedStateTxHash []byte
ArbiterTransactionSignature []byte
}
func UnmarshalResponse
func UnmarshalResponse(data []byte) (*ArbitrationResponse, error)
UnmarshalResponse strictly decodes and canonicalizes a 007 arbitration response.
type PoolPort
PoolPort is the only transaction capability required by the arbitration workflow. Implementations must verify transactions with MultisigPool, never modify the candidate or construct a replacement, and provide the arbiter role signature after seller verification succeeds.
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)
}
type Workflow
Workflow verifies 007 evidence and adds only the arbiter signature. It never prices content, replaces the seller candidate transaction, or submits a node transaction on the arbiter's behalf.
type Workflow struct {
// contains filtered or unexported fields
}
func NewWorkflow
func NewWorkflow(config WorkflowConfig) (*Workflow, error)
NewWorkflow requires a non-nil arbiter Signer, PoolPort, and authorization verifier. It returns an arbiter workflow with no storage or network side effects.
func (*Workflow) SignPayment
func (workflow *Workflow) SignPayment(ctx context.Context, request *ArbitrationRequest) (*ArbitrationResponse, error)
SignPayment decodes and verifies the opening proof, standalone 003 buyer authorization, seller candidate transaction, and seller signature. On success it returns a 007 response containing hashes of the authorized bytes and the detached arbiter signature; it does not broadcast or mutate the candidate.
type WorkflowConfig
WorkflowConfig supplies the arbiter signer, MultisigPool verification/signing port, and verifier for the buyer's signed 003 authorization.
type WorkflowConfig struct {
Signer pool.Signer
Pool PoolPort
AuthorizationVerifier bitfs.ContentTermsSignatureVerifier
}
Generated by gomarkdoc