cmd

package
v0.0.0-...-4b2a75f Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 74 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirTransactions = "transactions"
	DirProtocols    = "protocols"
	DirContracts    = "contracts"
)
View Source
const InterruptExitCode = 130

Variables

View Source
var (
	TimestampFlag     int64
	WindowFlag        int64
	ProfileFlag       bool
	ProfileFormatFlag string
	DeepLinkFlag      string
	VersionFlag       bool
)

Global flag variables

View Source
var ErrInterrupted = stderrors.New("interrupt received")

Functions

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func FixGoModDependencies

func FixGoModDependencies(verbose bool) error

FixGoModDependencies runs go mod tidy and go mod download FIXED: Isolated test mode to avoid modifying repo (Issue #4)

func FixMissingCacheDir

func FixMissingCacheDir(verbose bool) error

FixMissingCacheDir creates the cache directory structure FIXED: Uses isolated temp dir in tests instead of real home (Issue #2)

func FixProtocolRegistration

func FixProtocolRegistration(verbose bool) error

FixProtocolRegistration initializes protocol registry FIXED: Only creates file when missing; doesn't overwrite existing (Issue #10)

func FixSimulatorBinary

func FixSimulatorBinary(verbose bool) error

FixSimulatorBinary attempts to build the Soroban simulator FIXED: Handles Windows .exe suffix (Issue #1)

func FriendlyPath

func FriendlyPath(path string) string

FriendlyPath replaces the user's home directory with ~ for better readability

func GetCurrentSession

func GetCurrentSession() *session.Data

GetCurrentSession returns the active session if any

func IsCancellation

func IsCancellation(err error) bool

func IsInterrupted

func IsInterrupted(err error) bool

func NewDebugCommand

func NewDebugCommand(runner simulator.RunnerInterface) *cobra.Command

NewDebugCommand creates a new debug command with dependencies

func SetCurrentSession

func SetCurrentSession(data *session.Data)

SetCurrentSession stores the active session for later saving

func Verify

func Verify(log *AuditLog) error

Verify checks the integrity and signature of an AuditLog

func VerifyAuditLog

func VerifyAuditLog(auditLog *AuditLog) (bool, error)

VerifyAuditLog verifies the integrity and signature of an AuditLog. It returns true if both the hash and signature are valid.

Types

type AttestationCertificate

type AttestationCertificate struct {
	PEM     string `json:"pem"`
	Subject string `json:"subject"`
	Issuer  string `json:"issuer"`
	Serial  string `json:"serial"`
}

AttestationCertificate represents a single X.509 certificate in the hardware attestation chain. Certificates are ordered leaf-to-root.

type AuditLog

type AuditLog struct {
	Version             string               `json:"version"`
	Timestamp           time.Time            `json:"timestamp"`
	TransactionHash     string               `json:"transaction_hash"`
	TraceHash           string               `json:"trace_hash"`
	Signature           string               `json:"signature"`
	PublicKey           string               `json:"public_key"`
	Payload             Payload              `json:"payload"`
	HardwareAttestation *HardwareAttestation `json:"hardware_attestation,omitempty"`
}

AuditLog represents the signed audit trail of a transaction simulation

func Generate deprecated

func Generate(txHash string, envelopeXdr, resultMetaXdr string, events, logs []string, privateKeyHex string, opts *GenerateOptions) (*AuditLog, error)

Generate creates a signed audit log from the simulation results. If opts is non-nil and contains a HardwareAttestation, the attestation chain is embedded and covered by the signature.

Deprecated: prefer GenerateWithSigner which accepts an explicit signer.Signer implementation. This wrapper creates a temporary InMemorySigner from the hex key for backward compatibility.

func GenerateWithSigner

func GenerateWithSigner(txHash string, envelopeXdr, resultMetaXdr string, events, logs []string, s signer.Signer, opts *GenerateOptions) (*AuditLog, error)

GenerateWithSigner creates a signed audit log using the provided Signer implementation. The signer may be an InMemorySigner or a Pkcs11Signer; the private key material is never accessed directly.

type DebugCommand

type DebugCommand struct {
	Runner simulator.RunnerInterface
}

DebugCommand holds dependencies for the debug command

type DependencyID

type DependencyID string

DependencyID is a unique identifier for each dependency (Issue #8: type-safe dispatch)

const (
	DepGo                DependencyID = "go"
	DepRust              DependencyID = "rust"
	DepCargo             DependencyID = "cargo"
	DepSimulator         DependencyID = "simulator"
	DepCacheDir          DependencyID = "cache_dir"
	DepProtocolRegistry  DependencyID = "protocol_registry"
	DepGoModDependencies DependencyID = "go_mod_dependencies"
	DepConfigTOML        DependencyID = "toml_config"
	DepRPC               DependencyID = "rpc"
)

type DependencyStatus

type DependencyStatus struct {
	ID        DependencyID // NEW: unique identifier for type-safe dispatch
	Name      string
	Installed bool
	Version   string
	Path      string
	FixHint   string
	Fixable   bool // NEW: indicates if this can be auto-fixed
}

type GenerateOptions

type GenerateOptions struct {
	// HardwareAttestation, if non-nil, will be embedded in the signed
	// audit log. The attestation data is included in the hash to prevent
	// post-signing removal or substitution.
	HardwareAttestation *HardwareAttestation
}

GenerateOptions controls optional audit generation behavior

type HardwareAttestation

type HardwareAttestation struct {
	Certificates     []AttestationCertificate `json:"certificates"`
	TokenInfo        string                   `json:"token_info"`
	KeyNonExportable bool                     `json:"key_non_exportable"`
	RetrievedAt      string                   `json:"retrieved_at"`
}

HardwareAttestation contains the full attestation chain retrieved from an HSM or hardware security token. When present in an AuditLog it provides cryptographic proof that the signing key resides on a hardware device and is non-exportable.

type OverrideData

type OverrideData struct {
	LedgerEntries map[string]string `json:"ledger_entries,omitempty"`
}

type Payload

type Payload struct {
	EnvelopeXdr   string   `json:"envelope_xdr"`
	ResultMetaXdr string   `json:"result_meta_xdr"`
	Events        []string `json:"events"`
	Logs          []string `json:"logs"`
}

Payload contains the actual trace data

type ProtocolCheckResult

type ProtocolCheckResult struct {
	Registered bool
	Detail     string
}

ProtocolCheckResult holds the outcome of a protocol registration check.

type SignedAuditLog

type SignedAuditLog struct {
	Version   string          `json:"version"`
	Timestamp time.Time       `json:"timestamp"`
	TraceHash string          `json:"trace_hash"`
	Signature string          `json:"signature"`
	PublicKey string          `json:"public_key"`
	Payload   json.RawMessage `json:"payload"`
}

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	CommitSHA string `json:"commit_sha"`
	BuildDate string `json:"build_date"`
	GoVersion string `json:"go_version"`
}

Jump to

Keyboard shortcuts

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