config

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPrivateKeyVariable   = "PRIVATE_KEY"
	DefaultDirectAPIKeyVariable = "DIRECT_API_KEY"
)

Variables

This section is empty.

Functions

func PrivateKeyFromEnv

func PrivateKeyFromEnv(variableName string) (*ecdsa.PrivateKey, error)

PrivateKeyFromEnv extracts ecdsa private key from env variable.

Private key should be 32 bytes long hex string, but it can be shorter. It can be 0x or 0X prefixed or not.

Types

type Addresses

type Addresses struct {
	FlareSystemsManager common.Address `toml:"flare_systems_manager"`
	Relay               common.Address `toml:"relay"`
	VoterRegistry       common.Address `toml:"voter_registry"`
	MachinePathManager  common.Address `toml:"machine_path_manager"` // optional: when unset, the machine path list service is disabled.
}

Addresses of the smart contracts.

type Attestation added in v0.0.18

type Attestation struct {
	Enable bool `toml:"enable"`

	Audience              string   `toml:"audience"`                // expected aud claim; empty skips the audience check
	ExpectedCodeHashes    []string `toml:"expected_code_hashes"`    // 32-byte hex; accepts an optional 0x or sha256: prefix, but not both
	ExpectedPlatforms     []string `toml:"expected_platforms"`      // hwmodel strings, e.g. "AMD_SEV_SNP_VM"
	ExpectedDebugStatuses []string `toml:"expected_debug_statuses"` // dbgstat values, e.g. "disabled-since-boot"

	MaxTokenAge    time.Duration `toml:"max_token_age"`
	RequireSecBoot bool          `toml:"require_sec_boot"`

	// AllowMagicPass accepts the tee-node sentinel; dev/test only.
	AllowMagicPass bool `toml:"allow_magic_pass"`
}

Attestation controls bootstrap attestation verification. Empty allowlists / zero values skip the corresponding check.

func (Attestation) ParsedCodeHashes added in v0.0.18

func (a Attestation) ParsedCodeHashes() ([]common.Hash, error)

ParsedCodeHashes decodes ExpectedCodeHashes; safe after validate() passes.

type Direct

type Direct struct {
	Enable         bool   `toml:"enable"`           // Enable registers the /direct endpoint on the external server.
	APIKey         string `toml:"api_key"`          // APIKey for the /direct endpoint. Can also be set via env variable (see APIKeyVariable).
	APIKeyVariable string `toml:"api_key_variable"` // APIKeyVariable is the name of environment variable that stores the /direct endpoint API key. Defaults to DIRECT_API_KEY.
	APIKeyOptional bool   `toml:"api_key_optional"` // APIKeyOptional disables the API key requirement for the /direct endpoint.
	MaxBodySize    int64  `toml:"max_body_size"`    // MaxBodySize limits the body of the request on the /direct endpoint. If 0, the server applies its 10 MiB default.
}

Direct holds configuration for the /direct endpoint.

type Firestore

type Firestore struct {
	URL             string `toml:"url"`              // Firestore URL
	ProjectID       string `toml:"project_id"`       // Google Cloud project ID.
	DatabaseID      string `toml:"database_id"`      // Firestore database ID. Empty means default database.
	CredentialsFile string `toml:"credentials_file"` // Path to service account JSON key. Empty means Application Default Credentials.
}

Firestore holds Firestore connection configuration.

type InfoTiming

type InfoTiming struct {
	Initial                time.Duration `toml:"initial_timeout"`           // Bound on the bootstrap fetch; 0 means no timeout.
	CycleInternal          time.Duration `toml:"cycle_internal"`            // Period of the internal refresh cycle.
	CycleQueueResponseWait time.Duration `toml:"cycle_queue_response_wait"` // Per-refresh wait for a response.
}

InfoTiming controls the bootstrap and steady-state cadence of TEE info refreshes.

type Ports

type Ports struct {
	Internal string `toml:"internal"`
	External string `toml:"external"`
}

Ports holds the listen port configuration for the internal and external HTTP servers.

type Proxy

type Proxy struct {
	DB                           database.Config `toml:"db"`                               // C-chain indexer database config.
	RedisPort                    string          `toml:"redis_port"`                       // Redis database port.
	Firestore                    Firestore       `toml:"firestore"`                        // Firestore connection configuration.
	ChainID                      uint64          `toml:"chain_id"`                         // EVM chain ID bound into TEE/FDC2 signed payloads. Must be a positive integer.
	Addresses                    Addresses       `toml:"addresses"`                        // Smart contract addresses.
	Ports                        Ports           `toml:"ports"`                            // Servers ports.
	InfoTiming                   InfoTiming      `toml:"info_timing"`                      // Timing configuration for TEE info updates (duration between periodic checks and response timeout)
	Voting                       Voting          `toml:"voting"`                           // Instruction voting configurations.
	PrivateKeyVariable           string          `toml:"private_key_variable"`             // Name of environment variable that stores proxy's private key. Defaults to PRIVATE_KEY.
	InitialSigningPolicyOffset   int             `toml:"initial_signing_policy_offset"`    // 0 for current signing policy, n for "current - n". If not set it defaults to 3.
	SigningPolicyFetchInterval   time.Duration   `toml:"signing_policy_fetch_interval"`    // Duration between periodic checks for a new signing policy.
	MachinePathListFetchInterval time.Duration   `toml:"machine_path_list_fetch_interval"` // Duration between periodic checks for a newly signed machine path list. Defaults to 10m.
	DBSyncMaxSleepTime           time.Duration   `toml:"db_sync_max_sleep_time"`           // Max sleep between DB sync retries on startup. Defaults to 10m.
	Logging                      logger.Config   `toml:"logging"`                          // Logging configurations. Default is "DEBUG" level in consol.
	Direct                       Direct          `toml:"direct"`                           // Direct endpoint configuration.
	Storage                      Storage         `toml:"storage"`                          // TTLs applied to Redis/Firestore-backed persistent storage.
	Attestation                  Attestation     `toml:"attestation"`                      // Bootstrap attestation verification configuration.
}

Proxy holds the full configuration for the TEE proxy service.

func Read

func Read(path string) (Proxy, error)

Read reads Proxy configurations from toml file at path and validates them.

type Storage added in v0.0.18

type Storage struct {
	ActionTTL       time.Duration `toml:"action_ttl"`        // Retention for queued action bodies. Defaults to 14 days.
	ResultTTL       time.Duration `toml:"result_ttl"`        // Retention for Threshold/End results. Defaults to 14 days.
	SubmitResultTTL time.Duration `toml:"submit_result_ttl"` // Retention for Submit results. Defaults to 30 minutes.
	BackupTTL       time.Duration `toml:"backup_ttl"`        // Retention for backup bodies and index. Defaults to 8 days.
}

Storage holds TTLs for persistent stores (Redis/Firestore).

func (*Storage) SetDefault added in v0.0.18

func (s *Storage) SetDefault()

type Voting

type Voting struct {
	ProposalExpiration  time.Duration `toml:"proposal_expiration"`   // Duration the voting for a proposal is open for. Default is 120s
	MaxPendingRequests  uint          `toml:"max_pending_request"`   // Maximal number of open (unfinalized) proposals per provider. It defaults to 100.
	HistorySize         int           `toml:"history_size"`          // Number of most recent signing policy rounds to keep in memory. Defaults to 3.
	FinalizedBufferSize int           `toml:"finalized_buffer_size"` // Buffer size for the finalized instructions channel. Defaults to 10.
	MaxProviderVote     float64       `toml:"max_provider_vote"`     // Maximal possible fraction (0,1] of total weight a single provider can hold. Used to cap per-vote variable message size for restore operations. If unset, no cap is applied.
}

Voting holds tuning parameters for the instruction voting consensus.

func (*Voting) SetDefault

func (v *Voting) SetDefault() *Voting

SetDefault sets default values if applicable.

Jump to

Keyboard shortcuts

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