transfer

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package transfer implements engagement export/import: a portable bundle of an engagement's scope/findings/comments and its tamper-evident evidence chain. On import the chain is RE-VERIFIED and the bundle structurally validated BEFORE anything is written – a bundle whose hash chain does not verify (or whose internal references are inconsistent) is rejected, so chain-of-custody survives moving an engagement between Synapse instances.

Index

Constants

View Source
const BundleVersion = "synapse.engagement-bundle/v1"

BundleVersion identifies the bundle schema so an importer can refuse unknown formats.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	Version      string                 `json:"version"`
	ExportedAt   time.Time              `json:"exportedAt"`
	Engagement   *engagement.Engagement `json:"engagement"`
	Findings     []finding.Finding      `json:"findings"`
	Comments     []finding.Comment      `json:"comments"`
	Evidence     []evdom.Evidence       `json:"evidence"`
	EvidenceHead string                 `json:"evidenceHead"`
	// Attestation is the exporter's ed25519 signature over EvidenceHead, so the
	// recipient can verify the chain's ORIGIN, not just its integrity. Optional (the
	// exporting instance may not sign); verified on import when present.
	Attestation *evdom.Attestation `json:"attestation,omitempty"`
}

Bundle is the portable export of one engagement. Domain types are marshaled natively so export/import round-trip symmetrically; evidence items carry their Content + Hash so the chain re-verifies on import.

type Service

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

Service exports and imports engagement bundles.

func NewService

func NewService(engagements ports.EngagementRepository, findings ports.FindingRepository, comments ports.CommentRepository, ev *evidence.Service, audit ports.AuditLogger, clock ports.Clock, ids ports.IDGenerator) (*Service, error)

NewService validates dependencies and returns the transfer service.

func (*Service) Export

func (s *Service) Export(ctx context.Context, actor string, tenantID, engagementID shared.ID) (Bundle, error)

Export assembles a portable bundle for the engagement (its scope, findings, comments, and the full evidence chain) and records the egress on the audit log (a bundle leaves the instance with the whole custody chain).

func (*Service) Import

func (s *Service) Import(ctx context.Context, actor string, tenantID shared.ID, b Bundle) (*engagement.Engagement, error)

Import re-verifies + structurally validates the bundle, then materializes a NEW engagement (fresh id, so import never clobbers existing data) with the bundle's findings/comments/evidence remapped to it. ALL validation happens before the first write; if any write then fails, the partially-materialized engagement is rolled back (Delete cascades), so a broken/partial import never lingers. Audited.

Jump to

Keyboard shortcuts

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