wire
import "github.com/bsv8/go-bitfs/wire"
Package wire maps transport-level message kinds to the canonical encoders and strict decoders for 001–007. It copies exact CBOR bytes and adds no envelope, signature, storage, business validation, or network behavior; callers invoke the owning bitfs, pool, or arbitration verifier after decoding.
Index
- Constants
- func MarshalArbitrationRequest(message *arbitration.ArbitrationRequest) ([]byte, error)
- func MarshalArbitrationResponse(message *arbitration.ArbitrationResponse) ([]byte, error)
- func MarshalContentDelivery(message *bitfs.SignedContentDelivery) ([]byte, error)
- func MarshalContentRequest(message *bitfs.SignedContentRequest) ([]byte, error)
- func MarshalPaymentUpdate(message *pool.PaymentUpdate) ([]byte, error)
- func MarshalPoolFundingTxDelivery(message *pool.FundingTxDelivery) ([]byte, error)
- func MarshalPoolRefundPresignRequest(message *pool.RefundPresignRequest) ([]byte, error)
- func MarshalPoolRefundPresignResponse(message *pool.RefundPresignResponse) ([]byte, error)
- func MarshalQuote(message *bitfs.SignedFileQuote) ([]byte, error)
- func Unmarshal(kind Kind, rawCBOR []byte) (any, error)
- func UnmarshalArbitrationRequest(rawCBOR []byte) (*arbitration.ArbitrationRequest, error)
- func UnmarshalArbitrationResponse(rawCBOR []byte) (*arbitration.ArbitrationResponse, error)
- func UnmarshalContentDelivery(rawCBOR []byte) (*bitfs.SignedContentDelivery, error)
- func UnmarshalContentRequest(rawCBOR []byte) (*bitfs.SignedContentRequest, error)
- func UnmarshalPaymentUpdate(rawCBOR []byte) (*pool.PaymentUpdate, error)
- func UnmarshalPoolFundingTxDelivery(rawCBOR []byte) (*pool.FundingTxDelivery, error)
- func UnmarshalPoolRefundPresignRequest(rawCBOR []byte) (*pool.RefundPresignRequest, error)
- func UnmarshalPoolRefundPresignResponse(rawCBOR []byte) (*pool.RefundPresignResponse, error)
- func UnmarshalQuote(rawCBOR []byte) (*bitfs.SignedFileQuote, error)
- type Kind
- type Packet
Constants
ProtocolFamily is the wire protocol identifier carried by the transport layer.
const ProtocolFamily = "bitfs.protocol.v3"
func MarshalArbitrationRequest
func MarshalArbitrationRequest(message *arbitration.ArbitrationRequest) ([]byte, error)
MarshalArbitrationRequest encodes a seller's complete 007 evidence package.
func MarshalArbitrationResponse
func MarshalArbitrationResponse(message *arbitration.ArbitrationResponse) ([]byte, error)
MarshalArbitrationResponse encodes the arbiter hashes and detached signature.
func MarshalContentDelivery
func MarshalContentDelivery(message *bitfs.SignedContentDelivery) ([]byte, error)
MarshalContentDelivery encodes a SignedContentDelivery with bitfs's canonical encoder.
func MarshalContentRequest
func MarshalContentRequest(message *bitfs.SignedContentRequest) ([]byte, error)
MarshalContentRequest encodes a SignedContentRequest with bitfs's canonical encoder.
func MarshalPaymentUpdate
func MarshalPaymentUpdate(message *pool.PaymentUpdate) ([]byte, error)
MarshalPaymentUpdate encodes a buyer-authorized cumulative payment update.
func MarshalPoolFundingTxDelivery
func MarshalPoolFundingTxDelivery(message *pool.FundingTxDelivery) ([]byte, error)
MarshalPoolFundingTxDelivery encodes delivery of the pool funding transaction.
func MarshalPoolRefundPresignRequest
func MarshalPoolRefundPresignRequest(message *pool.RefundPresignRequest) ([]byte, error)
MarshalPoolRefundPresignRequest encodes a pool-opening presign request.
func MarshalPoolRefundPresignResponse
func MarshalPoolRefundPresignResponse(message *pool.RefundPresignResponse) ([]byte, error)
MarshalPoolRefundPresignResponse encodes a pool-opening presign response.
func MarshalQuote
func MarshalQuote(message *bitfs.SignedFileQuote) ([]byte, error)
MarshalQuote encodes a SignedFileQuote with bitfs's canonical encoder.
func Unmarshal
func Unmarshal(kind Kind, rawCBOR []byte) (any, error)
Unmarshal dispatches rawCBOR to the strict decoder selected by kind. It checks canonical encoding and shape; callers must still run the package verifier.
func UnmarshalArbitrationRequest
func UnmarshalArbitrationRequest(rawCBOR []byte) (*arbitration.ArbitrationRequest, error)
UnmarshalArbitrationRequest strictly decodes a 007 evidence package.
func UnmarshalArbitrationResponse
func UnmarshalArbitrationResponse(rawCBOR []byte) (*arbitration.ArbitrationResponse, error)
UnmarshalArbitrationResponse strictly decodes an arbiter response.
func UnmarshalContentDelivery
func UnmarshalContentDelivery(rawCBOR []byte) (*bitfs.SignedContentDelivery, error)
UnmarshalContentDelivery strictly decodes a SignedContentDelivery.
func UnmarshalContentRequest
func UnmarshalContentRequest(rawCBOR []byte) (*bitfs.SignedContentRequest, error)
UnmarshalContentRequest strictly decodes a SignedContentRequest.
func UnmarshalPaymentUpdate
func UnmarshalPaymentUpdate(rawCBOR []byte) (*pool.PaymentUpdate, error)
UnmarshalPaymentUpdate strictly decodes a cumulative payment update.
func UnmarshalPoolFundingTxDelivery
func UnmarshalPoolFundingTxDelivery(rawCBOR []byte) (*pool.FundingTxDelivery, error)
UnmarshalPoolFundingTxDelivery strictly decodes a pool funding transaction delivery.
func UnmarshalPoolRefundPresignRequest
func UnmarshalPoolRefundPresignRequest(rawCBOR []byte) (*pool.RefundPresignRequest, error)
UnmarshalPoolRefundPresignRequest strictly decodes a pool-opening presign request.
func UnmarshalPoolRefundPresignResponse
func UnmarshalPoolRefundPresignResponse(rawCBOR []byte) (*pool.RefundPresignResponse, error)
UnmarshalPoolRefundPresignResponse strictly decodes a pool-opening presign response.
func UnmarshalQuote
func UnmarshalQuote(rawCBOR []byte) (*bitfs.SignedFileQuote, error)
UnmarshalQuote strictly decodes a SignedFileQuote.
type Kind
Kind identifies the message type selected by the transport. The tag is not inserted into the signed 001–007 CBOR document.
type Kind uint16
const (
// Quote identifies a signed file quote message.
Quote Kind = 1
// PoolRefundPresignRequest identifies a pool opening request.
PoolRefundPresignRequest Kind = 2
// PoolRefundPresignResponse identifies a pool opening response.
PoolRefundPresignResponse Kind = 3
// PoolFundingTxDelivery identifies delivery of the pool funding transaction.
PoolFundingTxDelivery Kind = 4
// ContentRequest identifies a buyer's signed content request.
ContentRequest Kind = 5
// ContentDelivery identifies a seller's signed content delivery.
ContentDelivery Kind = 6
// CumulativePayment identifies a buyer-authorized payment update.
CumulativePayment Kind = 7
// ArbitrationRequest identifies evidence sent from a seller to an arbiter.
ArbitrationRequest Kind = 8
// ArbitrationResponse identifies the arbiter signature returned to a seller.
ArbitrationResponse Kind = 9
)
type Packet
Packet carries a transport-selected Kind and the exact canonical CBOR bytes produced by the corresponding protocol encoder. It adds no envelope.
type Packet struct {
Kind Kind
CBOR []byte
}
func Marshal
func Marshal(kind Kind, message any) (Packet, error)
Marshal dispatches to the canonical encoder for kind, rejects a mismatched Go value, and returns transport-ready CBOR without changing signed bytes.
Generated by gomarkdoc