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.dev2.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.dev2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev2.tar.gz
Algorithm Hash digest
SHA256 3b356853018368d747e788625794e8dfe9e331e2bde79ac159ed991ac40cf2cc
MD5 cdfaff572346fda77aa88be7179ff11b
BLAKE2b-256 f74e8f8b598cc248aabbe871c4cca902a04e824acabe72e65ae55f4a935a88f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 1059c04e589d58b3e720913f4fc23a5b2666e4ffe7bf8a389ab5f29e77497ad6
MD5 a0b1a4c295502071e2184d879e1ff8e4
BLAKE2b-256 56b44bc48052697b3bd2c2d727169193571d7c138b5c6771ac9281a189f3d542

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