Skip to main content

protocol/config

Package config reads, validates, and exposes the shyconfig manifest to server-side binaries (ABCI app, API server).

Import path: github.com/NickCarducci/Shyware-SDK/protocol/config

Manifest

Manifest is the fully-parsed shyconfig for server-side use. It contains only fields that server binaries act on — UI/SDK-only fields are ignored.

type Manifest struct {
ContractVersion string
App AppManifest
API APIManifest
Identity IdentityManifest
Signing SigningManifest
Deployment DeploymentManifest
Governance *GovernanceManifest // nil for non-shyshares deployments
// ... additional domain blocks
}

GovernanceManifest is nil when contract_version is not shyshares-v1.

Loading

manifest, err := config.Load("/opt/shyvoting/shyconfig.json")

Load reads the file, validates the JSON schema, applies SHYWARE_* environment variable overrides, and returns the parsed Manifest. It returns an error if required fields are missing or incompatible values are combined.

manifest, err := config.Parse(data []byte)

Parse accepts a raw JSON byte slice — used in tests and Lambda deployments where the config is supplied as an environment variable or embedded asset.

Environment variable overrides

SHYWARE_* prefix overrides apply at load time and take precedence over file values. Designed for CI/CD pipelines that inject secrets without storing them in the checked-in shyconfig:

Env varManifest field
SHYWARE_IDENTITY_ISSUER_PUBKEY_HEXidentity.issuer_pubkey_hex
SHYWARE_SIGNING_TALLY_KEY_IDsigning.tally_key_id
SHYWARE_API_BASE_URLapi.base_url

REDACTED placeholder values in the checked-in shyconfig are replaced at deploy time by these overrides, keeping secrets out of version control.

Validation

Parse enforces:

  • contract_version is a known value
  • Required domain blocks are present for the declared version
  • identity.provider is compatible with the declared recovery mode
  • signing.backend is one of the supported values

Invalid configurations return a descriptive error before the server starts, preventing misconfigured deployments from reaching production.