Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

secret-kernel-contracts

Shared provider-agnostic contracts for Secret Kernel: types, error classes and the provider registry.

Install this distribution alone when your code only declares types or catches errors, such as a library that receives a client. An application that uses secret-kernel-factory gets all of it from the factory, which re-exports this package.

uv add secret-kernel-contracts

Usage

from typing import Any

from secret_kernel.contracts import (
    GetSecretOptions,
    KeyValueParseOptions,
    SecretClient,
    SecretParseMode,
)


async def load_database_config(client: SecretClient) -> Any:
    secret = await client.get_secret(
        "database",
        GetSecretOptions(
            parse=SecretParseMode.KEY_VALUE,
            parse_options=KeyValueParseOptions(
                pair_separator=";", key_value_separator="=", trim=True
            ),
        ),
    )

    return secret.value

Public Contract

  • SecretClient: read-only secret client.
  • SecretParseMode.JSON: parses the decrypted string as JSON.
  • SecretParseMode.KEY_VALUE: parses key-value strings such as user=app;password=secret.
  • SecretNotFoundError, SecretPermissionError, SecretParseError, InvalidSecretNameError, SecretCapabilityNotSupportedError, SecretKernelConfigurationError and SecretProviderError: the shared hierarchy, all rooted in SecretKernelError.
  • SecretClientOptions: the client options — env, project, prefix, parse_options, cache and logger.
  • SecretLogger: the observability contract. The logger option is an object with one optional method per level, each taking a single descriptive string, and it is the only sink the kernel writes to. A line whose level the logger does not implement is dropped, so logging.getLogger("my-app") is a drop-in.

Secret names are resolved as /env/project/prefix/secret-name. Every part but the secret name is optional, and a per-call prefix replaces the client's.

Documentation

The normative public surface is in docs/secret-kernel-api-reference.md.

License

MIT

Metadata

Release files for secret-kernel-contracts 0.1.0a10

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

Source distribution (sdist)

Source distribution for secret-kernel-contracts 0.1.0a10
File Size Uploaded Provenance Actions
secret_kernel_contracts-0.1.0a10.tar.gz 8.5 kB Without provenance Details for secret_kernel_contracts-0.1.0a10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secret-kernel-contracts 0.1.0a10
File Interpreter ABI Platform Actions
secret_kernel_contracts-0.1.0a10-py3-none-any.whl Python 3 none any Details for secret_kernel_contracts-0.1.0a10-py3-none-any.whl

Total release size: 19.7 kB

Release files / secret_kernel_contracts-0.1.0a10.tar.gz

Download URL secret_kernel_contracts-0.1.0a10.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e3ed18214191d56f7c151dfb0c2adb7b6bba00633bc028aa1be210a25b652b71
BLAKE2b-256 checksum
How to use checksums
bfc70145c499c237b03447415ea70a80dab9d541247085067522cecc899c8f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / secret_kernel_contracts-0.1.0a10-py3-none-any.whl

Download URL secret_kernel_contracts-0.1.0a10-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aed1418e5f85f3c989347876d1febeb6dee405ea2e66e879af56a51b216a847
BLAKE2b-256 checksum
How to use checksums
cedbc49b2eb6a9465d69c1a7170c2fb5014ee6ace142015897f9498cb2a99423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for secret-kernel-contracts 0.1.0a10

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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