Skip to main content

SSH-based key provider for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_keyprovider_ssh

Swarmauri SSH Key Provider

An asynchronous KeyProviderBase implementation that keeps SSH key material in memory and bridges it to Swarmauri's signing abstractions.

Features

  • Generate new Ed25519, RSA-PSS (SHA-256), or ECDSA P-256 key pairs on demand.
  • Import existing private keys (PEM) or public keys (OpenSSH) while respecting each key's ExportPolicy.
  • Rotate keys, enumerate versions, and optionally destroy specific versions or entire key identifiers.
  • Export public keys as RFC 7517-compliant JWKs/JWKS with OpenSSH fingerprints embedded in the tags metadata.
  • Produce random bytes and derive keying material using the HKDF construction (RFC 5869).

Installation

Choose the tool that matches your workflow:

# pip
pip install swarmauri_keyprovider_ssh

# Poetry
poetry add swarmauri_keyprovider_ssh

# uv
uv add swarmauri_keyprovider_ssh

Usage

The provider exposes an asynchronous interface for creating and managing SSH-based signing keys. The snippet below creates a new Ed25519 key and exports its public component as a JSON Web Key (JWK):

import asyncio
from swarmauri_keyprovider_ssh import SshKeyProvider
from swarmauri_core.key_providers.types import (
    KeySpec,
    KeyAlg,
    KeyClass,
    ExportPolicy,
    KeyUse,
)


async def main() -> None:
    provider = SshKeyProvider()
    spec = KeySpec(
        klass=KeyClass.asymmetric,
        alg=KeyAlg.ED25519,
        uses=(KeyUse.SIGN, KeyUse.VERIFY),
        export_policy=ExportPolicy.PUBLIC_ONLY,
    )
    ref = await provider.create_key(spec)
    jwk = await provider.get_public_jwk(ref.kid)
    print(jwk)


asyncio.run(main())

Keys can also be rotated, and the provider will track key versions:

ref = await provider.create_key(spec)
await provider.rotate_key(ref.kid)
assert await provider.list_versions(ref.kid) == (1, 2)

Use destroy_key() to remove an entire key identifier or just a single version, and jwks(prefix_kids=...) when you need to emit a filtered JWKS for downstream consumers.

Existing keys can be imported from PEM or OpenSSH data and exposed via JWKS:

from pathlib import Path

pem = Path("id_ed25519").read_bytes()
ref = await provider.import_key(spec, pem)
jwks = await provider.jwks()

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_keyprovider_ssh-0.3.0.dev36.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_keyprovider_ssh-0.3.0.dev36-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_keyprovider_ssh-0.3.0.dev36.tar.gz.

File metadata

  • Download URL: swarmauri_keyprovider_ssh-0.3.0.dev36.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_keyprovider_ssh-0.3.0.dev36.tar.gz
Algorithm Hash digest
SHA256 02bb5d9397d1daa29c36df5b16af015a1aee31f9b10450a97b0a863c77edf1a2
MD5 988f248c33d9e6905bc2dccf3047a382
BLAKE2b-256 c1dac79fbe43981c88559e6e7ff839c8aa050ec379e68e2ab3935904dfe571db

See more details on using hashes here.

File details

Details for the file swarmauri_keyprovider_ssh-0.3.0.dev36-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_keyprovider_ssh-0.3.0.dev36-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_keyprovider_ssh-0.3.0.dev36-py3-none-any.whl
Algorithm Hash digest
SHA256 18b73fc6a4533a3c98fea22a89fc09314d469ea86b371d9a9ab6e31114e3d603
MD5 47d8fdfac4c8a05d5e8a93aed17d91eb
BLAKE2b-256 9c138e918fd28fa68e548b7c47785a79574f76b24679fdf2df2cbb59f2d0dbe4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page