Skip to main content

Python library for SPIFFE support

Project description

spiffe package

Overview

The spiffe package, part of the py-spiffe library, provides SPIFFE support and essential tools for interacting with the SPIFFE Workload API. It simplifies the management and validation of SPIFFE identities, supporting X509-SVIDs, JWT-SVIDs, and X.509 CA and JWKS Bundles.

Features

  • Automatic Management of SPIFFE Identities: Streamlines fetching, renewing, and validation of X.509 and JWT SVIDs.
  • Seamless Integration with SPIFFE Workload API: Facilitates communication with SPIRE or other SPIFFE Workload API compliant systems.
  • Continuous Update Handling: Automatically receives and applies updates for SVIDs and bundles, ensuring your application always uses valid certificates.

Prerequisites

  • A running instance of SPIRE or another SPIFFE Workload API implementation.
  • The SPIFFE_ENDPOINT_SOCKET environment variable set to the address of the Workload API (e.g., unix: /tmp/spire-agent/public/api.sock), or provided programmatically.

Usage

Below are examples demonstrating the core functionalities of the spiffe package.

WorkloadApiClient

from spiffe import WorkloadApiClient

# Fetch X.509 and JWT SVIDs
with WorkloadApiClient() as client:
    x509_svid = client.fetch_x509_svid()
    print(f'SPIFFE ID: {x509_svid.spiffe_id}')

    jwt_svid = client.fetch_jwt_svid(audience={"test"})
    print(f'SPIFFE ID: {jwt_svid.spiffe_id}')

X509Source

from spiffe import X509Source

# Automatically manage X.509 SVIDs and CA bundles
with X509Source() as source:
    x509_svid = source.svid
    print(f'SPIFFE ID: {x509_svid.spiffe_id}')

JwtSource

from spiffe import JwtSource

# Manage and validate JWT SVIDs and JWKS bundles
with JwtSource() as source:
    jwt_svid = source.fetch_svid(audience={'test'})
    print(f'SPIFFE ID: {jwt_svid.spiffe_id}')
    print(f'Token: {jwt_svid.token}')

Contributing

We welcome contributions to the spiffe package! Please see our contribution guidelines for more details. For feedback and issues, please submit them through the GitHub issue tracker.

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

spiffe-0.1.4.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

spiffe-0.1.4-py3-none-any.whl (55.9 kB view details)

Uploaded Python 3

File details

Details for the file spiffe-0.1.4.tar.gz.

File metadata

  • Download URL: spiffe-0.1.4.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for spiffe-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c8abbe8323f1fc32e3bd635639648d25875501ef01f3c80ba8c502965c46708d
MD5 212ea2c8179c73928b13c90b1ac7ccfe
BLAKE2b-256 2fdbc199e15c1fe716e8cb92f63bf16fffefb84245679d14ae1d4254a17baefc

See more details on using hashes here.

File details

Details for the file spiffe-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: spiffe-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 55.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure

File hashes

Hashes for spiffe-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c8bfcb3b544f8d149dff9d1aa905a2f4cceb8bd57b3c53836fadc61341bdecab
MD5 7385facc7543fbe24a7dab8a8016329b
BLAKE2b-256 abed84a7464685e3b7ac75a8ecb81e1b05dd67f958c127721aea136143e704ff

See more details on using hashes here.

Supported by

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