Skip to main content

CryptoServe Client - API client for CryptoServe server

Project description

cryptoserve-client

API client for communicating with CryptoServe server.

Installation

pip install cryptoserve-client

Usage

from cryptoserve_client import CryptoClient

# Initialize client
client = CryptoClient(
    server_url="https://api.cryptoserve.dev",
    token="your-identity-token",
)

# Encrypt data
ciphertext = client.encrypt(b"sensitive data", context="user-pii")

# Decrypt data
plaintext = client.decrypt(ciphertext, context="user-pii")

# Check health
info = client.get_identity_info()
print(f"Identity: {info['name']}")
print(f"Contexts: {info['allowed_contexts']}")

Async Support

pip install cryptoserve-client[async]
from cryptoserve_client import AsyncCryptoClient

async def main():
    async with AsyncCryptoClient(server_url, token) as client:
        ciphertext = await client.encrypt(b"data", context="user-pii")

Error Handling

from cryptoserve_client import (
    CryptoServeError,
    AuthenticationError,
    AuthorizationError,
    ContextNotFoundError,
)

try:
    client.encrypt(data, context="unknown")
except AuthorizationError:
    print("Not authorized for this context")
except ContextNotFoundError:
    print("Context doesn't exist")

License

Apache 2.0

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

cryptoserve_client-0.3.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptoserve_client-0.3.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file cryptoserve_client-0.3.0.tar.gz.

File metadata

  • Download URL: cryptoserve_client-0.3.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cryptoserve_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2f8d03c95af6132f2abc7a787acf5ddd1782b1b82bcc8fe687c706f77f967705
MD5 2c312aa03371fa97a284a6584b73ac8c
BLAKE2b-256 ea9643d18ba5aa7a5d4a07b1edcf7de151eefea4338ceb76b48bd44e23c56d37

See more details on using hashes here.

File details

Details for the file cryptoserve_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cryptoserve_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b63f5c375870781913b79fa5a82f742c1e87fcb3b88480f203a060ee9715f93
MD5 83bba2ff3485d5587b417dee4f7c6426
BLAKE2b-256 119bb0bcf539b2a1ea2e7b32c9a22f2bfe17a87dfdd7675be6c59b2d1adf8a65

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