Skip to main content

File-backed key provider for Swarmauri

Project description

Swamauri Logo

Swarmauri File Key Provider

A file-backed key provider implementing the KeyProviderBase interface. It manages symmetric and asymmetric keys on disk and exports public material via JWK/JWKS.

Installation

pip install swarmauri_keyprovider_file

Usage

import asyncio
from tempfile import TemporaryDirectory

from swarmauri_keyprovider_file import FileKeyProvider
from swarmauri_core.keys.types import (
    ExportPolicy,
    KeyAlg,
    KeyClass,
    KeySpec,
)
from swarmauri_core.crypto.types import KeyUse


async def run_example() -> str:
    with TemporaryDirectory() as tmp:
        provider = FileKeyProvider(tmp)
        spec = KeySpec(
            klass=KeyClass.symmetric,
            alg=KeyAlg.AES256_GCM,
            uses=(KeyUse.ENCRYPT,),
            export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
        )
        created = await provider.create_key(spec)
        provider2 = FileKeyProvider(tmp)
        loaded = await provider2.get_key(created.kid, include_secret=True)
        print(f"Loaded key: {loaded.kid}")


asyncio.run(run_example())

Entry Point

The provider registers under the swarmauri.key_providers entry point as FileKeyProvider.

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_file-0.2.0.dev5.tar.gz (10.0 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_file-0.2.0.dev5-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_keyprovider_file-0.2.0.dev5.tar.gz.

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev5.tar.gz
Algorithm Hash digest
SHA256 754622a8f29d4e62fa7b8f2fd8232bfe1f4155d929775d561ea962bb77ee2f7e
MD5 15eba6f24b7a6becaf9c7615d5eb2d41
BLAKE2b-256 c9dc5f2fdc8c0ba4efe84d26db8825ab838e9958ed4981a2a1844d3b1e1a9c2b

See more details on using hashes here.

File details

Details for the file swarmauri_keyprovider_file-0.2.0.dev5-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 0074f16231206bcbb138ddfcddc46d3b1b5e89efabe85de2e4853d00bef41927
MD5 06d88a67a0ec14cd4514d916a4a82618
BLAKE2b-256 7899785cff3877f4a3a8170fac98fcdbdf9c1b84cabd3879d09142bc6a0a75a3

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