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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev4.tar.gz
Algorithm Hash digest
SHA256 4bae80cfcb9d9da950970ce474c048afb05778ad3fe300c3bbcae23615f5392c
MD5 331d5bc3e9228c9d47259b516e8e8e36
BLAKE2b-256 4a98a507643e37e7e5d27d0990c0a9ea608a2239070f339a7e2768793f946714

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b2b30253b769e0b220d03f83eb052227a8cc2637bc25a582c00ffb7abd7e35
MD5 b8402acd11bc1d397f5a50c89b4647a5
BLAKE2b-256 29aa2de6a4e92d1ade88e88ea63cc2996ded4162fbcbdf8622dde182f571f105

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