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.1.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.1.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cryptoserve_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c280396e2dcf6ad36c674142cb6f2556391323ad35136b8c3c00477e5d309c7
MD5 c54c4fba0b8a287bc11569adf64c7b1b
BLAKE2b-256 09440f94641312aa57ef813f9cee0eb01c5a3a4393248c11a88d784991b6fe82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoserve_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a65362a41285881524a116ca59ea64eaa6a46d737d21aeb78c3891459abdd332
MD5 0f70df57d500e4e0fedba89d057f1a4d
BLAKE2b-256 21216b29e1481ec8d1dc342dce913c6c6aefd7a21dde1985c076ad36efe92ba3

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