Skip to main content

hegemony-secret-sdk

Public, dependency-light SDK for building Hegemony secret backend plugins — out-of-tree wheels that add secret storage backends to the core platform at runtime.

A plugin depends only on this package (which depends only on pydantic) and exposes a register(registry) callable under the hegemony.secret_backends entry-point group:

# In your plugin's pyproject.toml. The SDK is 0.x, where a breaking change
# releases a new minor version, so depend on one minor at a time.
[project]
dependencies = ["hegemony-secret-sdk>=0.3,<0.4"]

[project.entry-points."hegemony.secret_backends"]
my_plugin = "my_plugin:register"

Backends are leaf components

Unlike notification transports, secret backends receive no injected services or context from the host. A registered factory builds a concrete backend instance directly from an already-resolved configuration dict:

# my_plugin/__init__.py
from collections.abc import Mapping
from typing import Any

from hegemony_secret_sdk import SecretBackend, SecretBackendRegistry


class MyBackend:
    def __init__(self, config: dict) -> None:
        self._config = config

    def read(self, path: str) -> dict[str, str] | None: ...
    def write(self, path: str, data: Mapping[str, Any]) -> None: ...
    def delete(self, path: str) -> None: ...
    def test(self) -> None: ...


def build_my_backend(config: dict) -> MyBackend:
    return MyBackend(config)


def register(registry: SecretBackendRegistry) -> None:
    registry.register_backend_type(
        backend_type="my_backend",
        display_name="My Backend",
        description="Stores secrets in My Backend.",
        factory=build_my_backend,
        config_schema={
            "type": "object",
            "required": ["address"],
            "properties": {
                "address": {"type": "string", "title": "Server address"},
                "token": {"type": "string", "title": "Auth token", "x_secret_ref": True},
            },
        },
    )

A backend implements read, write, delete, and test (a lightweight connectivity/auth check that raises on failure). See SecretBackend.

Config-schema extension keys

The host understands a few x_-prefixed property keys in config_schema:

  • x_secret_ref: true — the field holds raw auth material; the host UI renders it with the secret/variable picker instead of a plain text input.
  • x_fallback_of: "<base field>" — the field overrides <base field> when set; the host UI shows the inheritance relationship on the form.
  • x_component: "api" | "worker" — combined with x_fallback_of, restricts the override to one host process: before calling the factory, the named process copies the field's value onto its base field and strips every x_component-marked field. Factories therefore only ever see base fields (see the vault plugin's api_role_id/worker_role_id, which let the API and worker authenticate with different AppRoles).

ABI

SDK_ABI_VERSION is bumped only on incompatible changes to the registration contract. The platform exposes its value as registry.api_version so a plugin can self-gate if needed.

API reference

Import public contracts from hegemony_secret_sdk. These are synchronous Python interfaces, not HTTP endpoints or coroutines. The host resolves configuration before calling the registered BackendFactory(config), which returns a SecretBackend.

register_backend_type(...) accepts keyword-only backend identity, display name, description and factory, plus optional configuration model, schema, defaults and hidden flag; it returns None. The model and schema are independent: the host may use the model for validation and the schema for UI rendering. The hidden flag requires host support.

Backend method Inputs Result
read Secret path string Mapping of secret fields, or None if absent
write Path and mapping of fields None
delete Path None; deleting an absent secret is not an error
test No arguments None; raises on connectivity/authentication failure
list (optional ListableSecretBackend) Path, defaulting to the empty string Immediate child names; containers end in /; unknown/empty locations return an empty list
wrap_data_key (optional DataKeyWrappingSecretBackend) Wrapping-key name Tuple of fresh 256-bit plaintext key bytes and wrapped-key string; creates a missing wrapping key
unwrap_data_key (optional DataKeyWrappingSecretBackend) Wrapping-key name and wrapped-key string Plaintext key bytes

The host feature-detects the optional protocols. Data-key wrapping keeps the wrapping key inside the store; the host stores the wrapped key alongside encrypted data. Do not include plaintext secrets or data keys in logs or errors. Backend failures raise exceptions; the SDK does not define a shared error envelope. The Vault/OpenBao and 1Password references describe backend configuration, path mapping and limitations.

From the repository root, render complete signatures and docstrings with:

uv sync --frozen --all-packages
uv run python -m pydoc hegemony_secret_sdk
uv run python -m pydoc hegemony_secret_sdk.backend
uv run python -m pydoc hegemony_secret_sdk.registry

For local HTML browsing, run uv run python -m pydoc -b, open the SDK module, and follow its class/module links; stop the server when finished. With an installed SDK, omit uv run.

Metadata

Release files for hegemony-secret-sdk 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hegemony-secret-sdk 0.3.7
File Size Uploaded Provenance Actions
hegemony_secret_sdk-0.3.7.tar.gz 19.6 kB With provenance Details for hegemony_secret_sdk-0.3.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hegemony-secret-sdk 0.3.7
File Interpreter ABI Platform Actions
hegemony_secret_sdk-0.3.7-py3-none-any.whl Python 3 none any Details for hegemony_secret_sdk-0.3.7-py3-none-any.whl

Total release size: 39.8 kB

Release files / hegemony_secret_sdk-0.3.7.tar.gz

Download URL hegemony_secret_sdk-0.3.7.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d2a52ee7dce17fb4f02dd9f9da369ef1b7d358392232f6158ba5aad71a3d6988
BLAKE2b-256 checksum
How to use checksums
c6ee7dbce923649038de6796970049e9d5fbecfca25a0195faba49a67711e3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / hegemony_secret_sdk-0.3.7-py3-none-any.whl

Download URL hegemony_secret_sdk-0.3.7-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14be456664daa628f74967af0a922eda74f8ca32414642900adb101348301c38
BLAKE2b-256 checksum
How to use checksums
480236542eae5f353450770eacd42df977157fd0370ec6dc3ce20f87b0c050f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for hegemony-secret-sdk 0.3.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hegemony_secret_sdk-0.3.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page