senderobject

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package senderobject implements the transport-neutral suite-0x02 object envelope.

Index

Constants

View Source
const (
	// The object version owns the signature construction independently of the v2 session wire.
	WireVersion    = byte(3)
	HeaderBytes    = 8
	NonceBytes     = 12
	SignatureBytes = ed25519.SignatureSize
	TagBytes       = 16
	FixedBytes     = HeaderBytes + NonceBytes + SignatureBytes

	MaxDescriptorBytes     = 16 << 10
	MaxCatalogPageBytes    = 60 << 10
	MaxDirectoryErrorBytes = 16 << 10
	MaxRevisionBytes       = 16 << 10
	MaxBlockRecordBytes    = (4 << 20) + 512
	MaxOfflineCommitBytes  = 16 << 10
)

Variables

View Source
var (
	ErrBinding   = errors.New("senderobject: invalid semantic binding")
	ErrKey       = errors.New("senderobject: invalid key material")
	ErrMalformed = errors.New("senderobject: malformed object")
	ErrTooLarge  = errors.New("senderobject: object exceeds its domain limit")
	ErrSignature = errors.New("senderobject: sender signature is invalid")
	ErrAuth      = errors.New("senderobject: ciphertext authentication failed")
)

Functions

func Open

func Open(binding Binding, key []byte, sender *senderauth.Verifier, object []byte) ([]byte, error)

func OpenDescriptorBootstrap

func OpenDescriptorBootstrap(binding Binding, key []byte, object []byte, senderIdentity func([]byte) (*senderauth.Verifier, error)) ([]byte, error)

OpenDescriptorBootstrap decrypts only to discover the sender key, then checks pkHash and the outer signature before releasing plaintext to the caller.

func Seal

func Seal(binding Binding, key []byte, signingKey ed25519.PrivateKey, nonce, plaintext []byte) ([]byte, error)

func Verify

func Verify(binding Binding, sender *senderauth.Verifier, object []byte) error

Types

type Binding

type Binding struct {
	// contains filtered or unexported fields
}

Binding owns the exact domain, context, and byte ceiling for one semantic object. Callers cannot construct an unbounded or context-free envelope.

func NewBlockRecordBinding

func NewBlockRecordBinding(shareInstance, fileID, revision []byte, localBlock uint64, dataLength uint32) (Binding, error)

func NewCatalogPageBinding

func NewCatalogPageBinding(shareInstance, directoryID []byte, page uint32) (Binding, error)

func NewDescriptorBinding

func NewDescriptorBinding(pkHash, shareIDRaw []byte) (Binding, error)

func NewDirectoryErrorBinding

func NewDirectoryErrorBinding(shareInstance, directoryID []byte) (Binding, error)

func NewOfflineCommitBinding

func NewOfflineCommitBinding(shareInstance []byte) (Binding, error)

func NewRevisionBinding

func NewRevisionBinding(shareInstance, fileID []byte) (Binding, error)

func (Binding) Context

func (b Binding) Context() []byte

func (Binding) Domain

func (b Binding) Domain() Domain

func (Binding) MaxBytes

func (b Binding) MaxBytes() int

type Domain

type Domain string
const (
	DomainDescriptor     Domain = "windshare/v2 object/descriptor"
	DomainCatalogPage    Domain = "windshare/v2 object/catalog-page"
	DomainDirectoryError Domain = "windshare/v2 object/directory-error"
	DomainRevision       Domain = "windshare/v2 object/file-revision"
	DomainBlockRecord    Domain = "windshare/v2 object/block-record"
	DomainOfflineCommit  Domain = "windshare/v2 object/offline-commit"
)

Jump to

Keyboard shortcuts

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