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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev3.tar.gz
Algorithm Hash digest
SHA256 465fd710f697584804b272ffcc78b86baebc49f7ba33d236225ed83c80746a1c
MD5 71fa397c9fe5641116fcf00502dd298c
BLAKE2b-256 6c8e63555f84ce9ecc6c60d2a9c5642502fc60f48beda4bd31104ad4c0dca888

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swarmauri_keyprovider_file-0.2.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 8786b74b102c2b6f46b6ad8d8cf0d00b996ee1779b62e106b0d1d55c8816b7ad
MD5 f96ee5f2c9eff37a42b959390747a74c
BLAKE2b-256 48050d96b1723256e9a87d27d0a3cfb7237daa33ab67c37437272897e3699bca

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